PageSourceSearch

https://betchworth-pc.gov.uk/wp-content/uploads/parish-cache/xmap-embed.mjs?ver=1790954463

js betchworth-pc.gov.uk collected 2026-10-02 22:22:15 UTC 1,024,251 bytes, 31,700 lines download raw bytes

vendor: 8,315 bytes, lines 1-301
1function l_(e) {
2  e("EPSG:4326", "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"), e("EPSG:4269", "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"), e("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"), e.WGS84 = e["EPSG:4326"], e["EPSG:3785"] = e["EPSG:3857"], e.GOOGLE = e["EPSG:3857"], e["EPSG:900913"] = e["EPSG:3857"], e["EPSG:102113"] = e["EPSG:3857"];
3}
4var vs = 1, Es = 2, sn = 3, h_ = 4, sl = 5, fc = 6378137, c_ = 6356752314e-3, gc = 0.0066943799901413165, Kn = 484813681109536e-20, A = Math.PI / 2, u_ = 0.16666666666666666, d_ = 0.04722222222222222, f_ = 0.022156084656084655, G = 1e-10, qt = 0.017453292519943295, Ni = 57.29577951308232, yt = Math.PI / 4, tr = Math.PI * 2, Dt = 3.14159265359, Me = {};
5Me.greenwich = 0;
6Me.lisbon = -9.131906111111;
7Me.paris = 2.337229166667;
8Me.bogota = -74.080916666667;
9Me.madrid = -3.687938888889;
10Me.rome = 12.452333333333;
11Me.bern = 7.439583333333;
12Me.jakarta = 106.807719444444;
13Me.ferro = -17.666666666667;
14Me.brussels = 4.367975;
15Me.stockholm = 18.058277777778;
16Me.athens = 23.7163375;
17Me.oslo = 10.722916666667;
18const g_ = {
19  ft: { to_meter: 0.3048 },
20  "us-ft": { to_meter: 1200 / 3937 }
21};
22var _c = /[\s_\-\/\(\)]/g;
23function Hi(e, t) {
24  if (e[t])
25    return e[t];
26  for (var i = Object.keys(e), s = t.toLowerCase().replace(_c, ""), n = -1, r, o; ++n < i.length; )
27    if (r = i[n], o = r.toLowerCase().replace(_c, ""), o === s)
28      return e[r];
29}
30function nl(e) {
31  var t = {}, i = e.split("+").map(function(a) {
32    return a.trim();
33  }).filter(function(a) {
34    return a;
35  }).reduce(function(a, l) {
36    var h = l.split("=");
37    return h.push(!0), a[h[0].toLowerCase()] = h[1], a;
38  }, {}), s, n, r, o = {
39    proj: "projName",
40    datum: "datumCode",
41    rf: function(a) {
42      t.rf = parseFloat(a);
43    },
44    lat_0: function(a) {
45      t.lat0 = a * qt;
46    },
47    lat_1: function(a) {
48      t.lat1 = a * qt;
49    },
50    lat_2: function(a) {
51      t.lat2 = a * qt;
52    },
53    lat_ts: function(a) {
54      t.lat_ts = a * qt;
55    },
56    lon_0: function(a) {
57      t.long0 = a * qt;
58    },
59    lon_1: function(a) {
60      t.long1 = a * qt;
61    },
62    lon_2: function(a) {
63      t.long2 = a * qt;
64    },
65    alpha: function(a) {
66      t.alpha = parseFloat(a) * qt;
67    },
68    gamma: function(a) {
69      t.rectified_grid_angle = parseFloat(a);
70    },
71    lonc: function(a) {
72      t.longc = a * qt;
73    },
74    x_0: function(a) {
75      t.x0 = parseFloat(a);
76    },
77    y_0: function(a) {
78      t.y0 = parseFloat(a);
79    },
80    k_0: function(a) {
81      t.k0 = parseFloat(a);
82    },
83    k: function(a) {
84      t.k0 = parseFloat(a);
85    },
86    a: function(a) {
87      t.a = parseFloat(a);
88    },
89    b: function(a) {
90      t.b = parseFloat(a);
91    },
92    r_a: function() {
93      t.R_A = !0;
94    },
95    zone: function(a) {
96      t.zone = parseInt(a, 10);
97    },
98    south: function() {
99      t.utmSouth = !0;
100    },
101    towgs84: function(a) {
102      t.datum_params = a.split(",").map(function(l) {
103        return parseFloat(l);
104      });
105    },
106    to_meter: function(a) {
107      t.to_meter = parseFloat(a);
108    },
109    units: function(a) {
110      t.units = a;
111      var l = Hi(g_, a);
112      l && (t.to_meter = l.to_meter);
113    },
114    from_greenwich: function(a) {
115      t.from_greenwich = a * qt;
116    },
117    pm: function(a) {
118      var l = Hi(Me, a);
119      t.from_greenwich = (l || parseFloat(a)) * qt;
120    },
121    nadgrids: function(a) {
122      a === "@null" ? t.datumCode = "none" : t.nadgrids = a;
123    },
124    axis: function(a) {
125      var l = "ewnsud";
126      a.length === 3 && l.indexOf(a.substr(0, 1)) !== -1 && l.indexOf(a.substr(1, 1)) !== -1 && l.indexOf(a.substr(2, 1)) !== -1 && (t.axis = a);
127    },
128    approx: function() {
129      t.approx = !0;
130    }
131  };
132  for (s in i)
133    n = i[s], s in o ? (r = o[s], typeof r == "function" ? r(n) : t[r] = n) : t[s] = n;
134  return typeof t.datumCode == "string" && t.datumCode !== "WGS84" && (t.datumCode = t.datumCode.toLowerCase()), t;
135}
136var er = 1, fd = 2, gd = 3, xo = 4, _d = 5, Ul = -1, __ = /\s/, m_ = /[A-Za-z]/, p_ = /[A-Za-z84_]/, Ko = /[,\]]/, md = /[\d\.E\-\+]/;
137function Ci(e) {
138  if (typeof e != "string")
139    throw new Error("not a string");
140  this.text = e.trim(), this.level = 0, this.place = 0, this.root = null, this.stack = [], this.currentObject = null, this.state = er;
141}
142Ci.prototype.readCharicter = function() {
143  var e = this.text[this.place++];
144  if (this.state !== xo)
145    for (; __.test(e); ) {
146      if (this.place >= this.text.length)
147        return;
148      e = this.text[this.place++];
149    }
150  switch (this.state) {
151    case er:
152      return this.neutral(e);
153    case fd:
154      return this.keyword(e);
155    case xo:
156      return this.quoted(e);
157    case _d:
158      return this.afterquote(e);
159    case gd:
160      return this.number(e);
161    case Ul:
162      return;
163  }
164};
165Ci.prototype.afterquote = function(e) {
166  if (e === '"') {
167    this.word += '"', this.state = xo;
168    return;
169  }
170  if (Ko.test(e)) {
171    this.word = this.word.trim(), this.afterItem(e);
172    return;
173  }
174  throw new Error(`havn't handled "` + e + '" in afterquote yet, index ' + this.place);
175};
176Ci.prototype.afterItem = function(e) {
177  if (e === ",") {
178    this.word !== null && this.currentObject.push(this.word), this.word = null, this.state = er;
179    return;
180  }
181  if (e === "]") {
182    this.level--, this.word !== null && (this.currentObject.push(this.word), this.word = null), this.state = er, this.currentObject = this.stack.pop(), this.currentObject || (this.state = Ul);
183    return;
184  }
185};
186Ci.prototype.number = function(e) {
187  if (md.test(e)) {
188    this.word += e;
189    return;
190  }
191  if (Ko.test(e)) {
192    this.word = parseFloat(this.word), this.afterItem(e);
193    return;
194  }
195  throw new Error(`havn't handled "` + e + '" in number yet, index ' + this.place);
196};
197Ci.prototype.quoted = function(e) {
198  if (e === '"') {
199    this.state = _d;
200    return;
201  }
202  this.word += e;
203};
204Ci.prototype.keyword = function(e) {
205  if (p_.test(e)) {
206    this.word += e;
207    return;
208  }
209  if (e === "[") {
210    var t = [];
211    t.push(this.word), this.level++, this.root === null ? this.root = t : this.currentObject.push(t), this.stack.push(this.currentObject), this.currentObject = t, this.state = er;
212    return;
213  }
214  if (Ko.test(e)) {
215    this.afterItem(e);
216    return;
217  }
218  throw new Error(`havn't handled "` + e + '" in keyword yet, index ' + this.place);
219};
220Ci.prototype.neutral = function(e) {
221  if (m_.test(e)) {
222    this.word = e, this.state = fd;
223    return;
224  }
225  if (e === '"') {
226    this.word = "", this.state = xo;
227    return;
228  }
229  if (md.test(e)) {
230    this.word = e, this.state = gd;
231    return;
232  }
233  if (Ko.test(e)) {
234    this.afterItem(e);
235    return;
236  }
237  throw new Error(`havn't handled "` + e + '" in neutral yet, index ' + this.place);
238};
239Ci.prototype.output = function() {
240  for (; this.place < this.text.length; )
241    this.readCharicter();
242  if (this.state === Ul)
243    return this.root;
244  throw new Error('unable to parse string "' + this.text + '". State is ' + this.state);
245};
246function y_(e) {
247  var t = new Ci(e);
248  return t.output();
249}
250function mc(e, t, i) {
251  Array.isArray(t) && (i.unshift(t), t = null);
252  var s = t ? {} : e, n = i.reduce(function(r, o) {
253    return Ks(o, r), r;
254  }, s);
255  t && (e[t] = n);
256}
257function Ks(e, t) {
258  if (!Array.isArray(e)) {
259    t[e] = !0;
260    return;
261  }
262  var i = e.shift();
263  if (i === "PARAMETER" && (i = e.shift()), e.length === 1) {
264    if (Array.isArray(e[0])) {
265      t[i] = {}, Ks(e[0], t[i]);
266      return;
267    }
268    t[i] = e[0];
269    return;
270  }
271  if (!e.length) {
272    t[i] = !0;
273    return;
274  }
275  if (i === "TOWGS84") {
276    t[i] = e;
277    return;
278  }
279  if (i === "AXIS") {
280    i in t || (t[i] = []), t[i].push(e);
281    return;
282  }
283  Array.isArray(i) || (t[i] = {});
284  var s;
285  switch (i) {
286    case "UNIT":
287    case "PRIMEM":
288    case "VERT_DATUM":
289      t[i] = {
290        name: e[0].toLowerCase(),
291        convert: e[1]
292      }, e.length === 3 && Ks(e[2], t[i]);
293      return;
294    case "SPHEROID":
295    case "ELLIPSOID":
296      t[i] = {
297        name: e[0],
298        a: e[1],
299        rf: e[2]
300      }, e.length === 4 && Ks(e[3], t[i]);
301      return;
302    case "PROJECTEDCRS":
303    case "PROJCRS":
304    case "GEOGCS":
305    case "GEOCCS":
306    case "PROJCS":
307    case "LOCAL_CS":
308    case "GEODCRS":
309    case "GEODETICCRS":
310    case "GEODETICDATUM":
311    case "EDATUM":
312    case "ENGINEERINGDATUM":
313    case "VERT_CS":
314    case "VERTCRS":
315    case "VERTICALCRS":
316    case "COMPD_CS":
317    case "COMPOUNDCRS":
318    case "ENGINEERINGCRS":
319    case "ENGCRS":
320    case "FITTED_CS":
321    case "LOCAL_DATUM":
322    case "DATUM":
323      e[0] = ["name", e[0]], mc(t, i, e);
324      return;
325    default:
326      for (s = -1; ++s < e.length; )
327        if (!Array.isArray(e[s]))
328          return Ks(e, t[i]);
329      return mc(t, i, e);
330  }
331}
332var x_ = 0.017453292519943295;
333function v_(e, t) {
334  var i = t[0], s = t[1];
335  !(i in e) && s in e && (e[i] = e[s], t.length === 3 && (e[i] = t[2](e[i])));
336}
337function Xe(e) {
338  return e * x_;
339}
340function E_(e) {
341  if (e.type === "GEOGCS" ? e.projName = "longlat" : e.type === "LOCAL_CS" ? (e.projName = "identity", e.local = !0) : typeof e.PROJECTION == "object" ? e.projName = Object.keys(e.PROJECTION)[0] : e.projName = e.PROJECTION, e.AXIS) {
342    for (var t = "", i = 0, s = e.AXIS.length; i < s; ++i) {
343      var n = [e.AXIS[i][0].toLowerCase(), e.AXIS[i][1].toLowerCase()];
344      n[0].indexOf("north") !== -1 || (n[0] === "y" || n[0] === "lat") && n[1] === "north" ? t += "n" : n[0].indexOf("south") !== -1 || (n[0] === "y" || n[0] === "lat") && n[1] === "south" ? t += "s" : n[0].indexOf("east") !== -1 || (n[0] === "x" || n[0] === "lon") && n[1] === "east" ? t += "e" : (n[0].indexOf("west") !== -1 || (n[0] === "x" || n[0] === "lon") && n[1] === "west") && (t += "w");
345    }
346    t.length === 2 && (t += "u"), t.length === 3 && (e.axis = t);
347  }
348  e.UNIT && (e.units = e.UNIT.name.toLowerCase(), e.units === "metre" && (e.units = "meter"), e.UNIT.convert && (e.type === "GEOGCS" ? e.DATUM && e.DATUM.SPHEROID && (e.to_meter = e.UNIT.convert * e.DATUM.SPHEROID.a) : e.to_meter = e.UNIT.convert));
349  var r = e.GEOGCS;
350  e.type === "GEOGCS" && (r = e), r && (r.DATUM ? e.datumCode = r.DATUM.name.toLowerCase() : e.datumCode = r.name.toLowerCase(), e.datumCode.slice(0, 2) === "d_" && (e.datumCode = e.datumCode.slice(2)), (e.datumCode === "new_zealand_geodetic_datum_1949" || e.datumCode === "new_zealand_1949") && (e.datumCode = "nzgd49"), (e.datumCode === "wgs_1984" || e.datumCode === "world_geodetic_system_1984") && (e.PROJECTION === "Mercator_Auxiliary_Sphere" && (e.sphere = !0), e.datumCode = "wgs84"), e.datumCode.slice(-6) === "_ferro" && (e.datumCode = e.datumCode.slice(0, -6)), e.datumCode.slice(-8) === "_jakarta" && (e.datumCode = e.datumCode.slice(0, -8)), ~e.datumCode.indexOf("belge") && (e.datumCode = "rnb72"), r.DATUM && r.DATUM.SPHEROID && (e.ellps = r.DATUM.SPHEROID.name.replace("_19", "").replace(/[Cc]larke\_18/, "clrk"), e.ellps.toLowerCase().slice(0, 13) === "international" && (e.ellps = "intl"), e.a = r.DATUM.SPHEROID.a, e.rf = parseFloat(r.DATUM.SPHEROID.rf, 10)), r.DATUM && r.DATUM.TOWGS84 && (e.datum_params = r.DATUM.TOWGS84), ~e.datumCode.indexOf("osgb_1936") && (e.datumCode = "osgb36"), ~e.datumCode.indexOf("osni_1952") && (e.datumCode = "osni52"), (~e.datumCode.indexOf("tm65") || ~e.datumCode.indexOf("geodetic_datum_of_1965")) && (e.datumCode = "ire65"), e.datumCode === "ch1903+" && (e.datumCode = "ch1903"), ~e.datumCode.indexOf("israel") && (e.datumCode = "isr93")), e.b && !isFinite(e.b) && (e.b = e.a);
351  function o(h) {
352    var c = e.to_meter || 1;
353    return h * c;
354  }
355  var a = function(h) {
356    return v_(e, h);
357  }, l = [
358    ["standard_parallel_1", "Standard_Parallel_1"],
359    ["standard_parallel_1", "Latitude of 1st standard parallel"],
360    ["standard_parallel_2", "Standard_Parallel_2"],
361    ["standard_parallel_2", "Latitude of 2nd standard parallel"],
362    ["false_easting", "False_Easting"],
363    ["false_easting", "False easting"],
364    ["false-easting", "Easting at false origin"],
365    ["false_northing", "False_Northing"],
366    ["false_northing", "False northing"],
367    ["false_northing", "Northing at false origin"],
368    ["central_meridian", "Central_Meridian"],
369    ["central_meridian", "Longitude of natural origin"],
370    ["central_meridian", "Longitude of false origin"],
371    ["latitude_of_origin", "Latitude_Of_Origin"],
372    ["latitude_of_origin", "Central_Parallel"],
373    ["latitude_of_origin", "Latitude of natural origin"],
374    ["latitude_of_origin", "Latitude of false origin"],
375    ["scale_factor", "Scale_Factor"],
376    ["k0", "scale_factor"],
377    ["latitude_of_center", "Latitude_Of_Center"],
378    ["latitude_of_center", "Latitude_of_center"],
379    ["lat0", "latitude_of_center", Xe],
380    ["longitude_of_center", "Longitude_Of_Center"],
381    ["longitude_of_center", "Longitude_of_center"],
382    ["longc", "longitude_of_center", Xe],
383    ["x0", "false_easting", o],
384    ["y0", "false_northing", o],
385    ["long0", "central_meridian", Xe],
386    ["lat0", "latitude_of_origin", Xe],
387    ["lat0", "standard_parallel_1", Xe],
388    ["lat1", "standard_parallel_1", Xe],
389    ["lat2", "standard_parallel_2", Xe],
390    ["azimuth", "Azimuth"],
391    ["alpha", "azimuth", Xe],
392    ["srsCode", "name"]
393  ];
394  l.forEach(a), !e.long0 && e.longc && (e.projName === "Albers_Conic_Equal_Area" || e.projName === "Lambert_Azimuthal_Equal_Area") && (e.long0 = e.longc), !e.lat_ts && e.lat1 && (e.projName === "Stereographic_South_Pole" || e.projName === "Polar Stereographic (variant B)") ? (e.lat0 = Xe(e.lat1 > 0 ? 90 : -90), e.lat_ts = e.lat1) : !e.lat_ts && e.lat0 && e.projName === "Polar_Stereographic" && (e.lat_ts = e.lat0, e.lat0 = Xe(e.lat0 > 0 ? 90 : -90));
395}
396function pd(e) {
397  var t = y_(e), i = t.shift(), s = t.shift();
398  t.unshift(["name", s]), t.unshift(["type", i]);
399  var n = {};
400  return Ks(t, n), E_(n), n;
401}
402function he(e) {
403  var t = this;
404  if (arguments.length === 2) {
405    var i = arguments[1];
406    typeof i == "string" ? i.charAt(0) === "+" ? he[e] = nl(arguments[1]) : he[e] = pd(arguments[1]) : he[e] = i;
407  } else if (arguments.length === 1) {
408    if (Array.isArray(e))
409      return e.map(function(s) {
410        Array.isArray(s) ? he.apply(t, s) : he(s);
411      });
412    if (typeof e == "string") {
413      if (e in he)
414        return he[e];
415    } else
416      "EPSG" in e ? he["EPSG:" + e.EPSG] = e : "ESRI" in e ? he["ESRI:" + e.ESRI] = e : "IAU2000" in e && (he["IAU2000:" + e.IAU2000] = e);
417    return;
418  }
419}
420l_(he);
421function M_(e) {
422  return typeof e == "string";
423}
424function C_(e) {
425  return e in he;
426}
427var b_ = ["PROJECTEDCRS", "PROJCRS", "GEOGCS", "GEOCCS", "PROJCS", "LOCAL_CS", "GEODCRS", "GEODETICCRS", "GEODETICDATUM", "ENGCRS", "ENGINEERINGCRS"];
428function w_(e) {
429  return b_.some(function(t) {
430    return e.indexOf(t) > -1;
431  });
432}
433var S_ = ["3857", "900913", "3785", "102113"];
434function T_(e) {
435  var t = Hi(e, "authority");
436  if (t) {
437    var i = Hi(t, "epsg");
438    return i && S_.indexOf(i) > -1;
439  }
440}
441function R_(e) {
442  var t = Hi(e, "extension");
443  if (t)
444    return Hi(t, "proj4");
445}
446function I_(e) {
447  return e[0] === "+";
448}
449function P_(e) {
450  if (M_(e)) {
451    if (C_(e))
452      return he[e];
453    if (w_(e)) {
454      var t = pd(e);
455      if (T_(t))
456        return he["EPSG:3857"];
457      var i = R_(t);
458      return i ? nl(i) : t;
459    }
460    if (I_(e))
461      return nl(e);
462  } else
463    return e;
464}
465function pc(e, t) {
466  e = e || {};
467  var i, s;
468  if (!t)
469    return e;
470  for (s in t)
471    i = t[s], i !== void 0 && (e[s] = i);
472  return e;
473}
474function ti(e, t, i) {
475  var s = e * t;
476  return i / Math.sqrt(1 - s * s);
477}
478function Er(e) {
479  return e < 0 ? -1 : 1;
480}
481function U(e) {
482  return Math.abs(e) <= Dt ? e : e - Er(e) * tr;
483}
484function ze(e, t, i) {
485  var s = e * i, n = 0.5 * e;
486  return s = Math.pow((1 - s) / (1 + s), n), Math.tan(0.5 * (A - t)) / s;
487}
488function ir(e, t) {
489  for (var i = 0.5 * e, s, n, r = A - 2 * Math.atan(t), o = 0; o <= 15; o++)
490    if (s = e * Math.sin(r), n = A - 2 * Math.atan(t * Math.pow((1 - s) / (1 + s), i)) - r, r += n, Math.abs(n) <= 1e-10)
491      return r;
492  return -9999;
493}
494function A_() {
495  var e = this.b / this.a;
496  this.es = 1 - e * e, "x0" in this || (this.x0 = 0), "y0" in this || (this.y0 = 0), this.e = Math.sqrt(this.es), this.lat_ts ? this.sphere ? this.k0 = Math.cos(this.lat_ts) : this.k0 = ti(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) : this.k0 || (this.k ? this.k0 = this.k : this.k0 = 1);
497}
498function L_(e) {
499  var t = e.x, i = e.y;
500  if (i * Ni > 90 && i * Ni < -90 && t * Ni > 180 && t * Ni < -180)
501    return null;
502  var s, n;
503  if (Math.abs(Math.abs(i) - A) <= G)
504    return null;
505  if (this.sphere)
506    s = this.x0 + this.a * this.k0 * U(t - this.long0), n = this.y0 + this.a * this.k0 * Math.log(Math.tan(yt + 0.5 * i));
507  else {
508    var r = Math.sin(i), o = ze(this.e, i, r);
509    s = this.x0 + this.a * this.k0 * U(t - this.long0), n = this.y0 - this.a * this.k0 * Math.log(o);
510  }
511  return e.x = s, e.y = n, e;
512}
513function O_(e) {
514  var t = e.x - this.x0, i = e.y - this.y0, s, n;
515  if (this.sphere)
516    n = A - 2 * Math.atan(Math.exp(-i / (this.a * this.k0)));
517  else {
518    var r = Math.exp(-i / (this.a * this.k0));
519    if (n = ir(this.e, r), n === -9999)
520      return null;
521  }
522  return s = U(this.long0 + t / (this.a * this.k0)), e.x = s, e.y = n, e;
523}
524var F_ = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
525const k_ = {
526  init: A_,
527  forward: L_,
528  inverse: O_,
529  names: F_
530};
531function D_() {
532}
533function yc(e) {
534  return e;
535}
536var N_ = ["longlat", "identity"];
537const G_ = {
538  init: D_,
539  forward: yc,
540  inverse: yc,
541  names: N_
542};
543var z_ = [k_, G_], co = {}, vo = [];
544function yd(e, t) {
545  var i = vo.length;
546  return e.names ? (vo[i] = e, e.names.forEach(function(s) {
547    co[s.toLowerCase()] = i;
548  }), this) : !0;
549}
550function j_(e) {
551  if (!e)
552    return !1;
553  var t = e.toLowerCase();
554  if (typeof co[t] < "u" && vo[co[t]])
555    return vo[co[t]];
556}
557function W_() {
558  z_.forEach(yd);
559}
560const B_ = {
561  start: W_,
562  add: yd,
563  get: j_
564};
565var st = {};
566st.MERIT = {
567  a: 6378137,
568  rf: 298.257,
569  ellipseName: "MERIT 1983"
570};
571st.SGS85 = {
572  a: 6378136,
573  rf: 298.257,
574  ellipseName: "Soviet Geodetic System 85"
575};
576st.GRS80 = {
577  a: 6378137,
578  rf: 298.257222101,
579  ellipseName: "GRS 1980(IUGG, 1980)"
580};
581st.IAU76 = {
582  a: 6378140,
583  rf: 298.257,
584  ellipseName: "IAU 1976"
585};
586st.airy = {
587  a: 6377563396e-3,
588  b: 635625691e-2,
589  ellipseName: "Airy 1830"
590};
591st.APL4 = {
592  a: 6378137,
593  rf: 298.25,
594  ellipseName: "Appl. Physics. 1965"
595};
596st.NWL9D = {
597  a: 6378145,
598  rf: 298.25,
599  ellipseName: "Naval Weapons Lab., 1965"
600};
601st.mod_airy = {
602  a: 6377340189e-3,
603  b: 6356034446e-3,
604  ellipseName: "Modified Airy"
605};
606st.andrae = {
607  a: 637710443e-2,
608  rf: 300,
609  ellipseName: "Andrae 1876 (Den., Iclnd.)"
610};
611st.aust_SA = {
612  a: 6378160,
613  rf: 298.25,
614  ellipseName: "Australian Natl & S. Amer. 1969"
615};
616st.GRS67 = {
617  a: 6378160,
618  rf: 298.247167427,
619  ellipseName: "GRS 67(IUGG 1967)"
620};
621st.bessel = {
622  a: 6377397155e-3,
623  rf: 299.1528128,
624  ellipseName: "Bessel 1841"
625};
626st.bess_nam = {
627  a: 6377483865e-3,
628  rf: 299.1528128,
629  ellipseName: "Bessel 1841 (Namibia)"
630};
631st.clrk66 = {
632  a: 63782064e-1,
633  b: 63565838e-1,
634  ellipseName: "Clarke 1866"
635};
636st.clrk80 = {
637  a: 6378249145e-3,
638  rf: 293.4663,
639  ellipseName: "Clarke 1880 mod."
640};
641st.clrk80ign = {
642  a: 63782492e-1,
643  b: 6356515,
644  rf: 293.4660213,
645  ellipseName: "Clarke 1880 (IGN)"
646};
647st.clrk58 = {
648  a: 6378293645208759e-9,
649  rf: 294.2606763692654,
650  ellipseName: "Clarke 1858"
651};
652st.CPM = {
653  a: 63757387e-1,
654  rf: 334.29,
655  ellipseName: "Comm. des Poids et Mesures 1799"
656};
657st.delmbr = {
658  a: 6376428,
659  rf: 311.5,
660  ellipseName: "Delambre 1810 (Belgium)"
661};
662st.engelis = {
663  a: 637813605e-2,
664  rf: 298.2566,
665  ellipseName: "Engelis 1985"
666};
667st.evrst30 = {
668  a: 6377276345e-3,
669  rf: 300.8017,
670  ellipseName: "Everest 1830"
671};
672st.evrst48 = {
673  a: 6377304063e-3,
674  rf: 300.8017,
675  ellipseName: "Everest 1948"
676};
677st.evrst56 = {
678  a: 6377301243e-3,
679  rf: 300.8017,
680  ellipseName: "Everest 1956"
681};
682st.evrst69 = {
683  a: 6377295664e-3,
684  rf: 300.8017,
685  ellipseName: "Everest 1969"
686};
687st.evrstSS = {
688  a: 6377298556e-3,
689  rf: 300.8017,
690  ellipseName: "Everest (Sabah & Sarawak)"
691};
692st.fschr60 = {
693  a: 6378166,
694  rf: 298.3,
695  ellipseName: "Fischer (Mercury Datum) 1960"
696};
697st.fschr60m = {
698  a: 6378155,
699  rf: 298.3,
700  ellipseName: "Fischer 1960"
701};
702st.fschr68 = {
703  a: 6378150,
704  rf: 298.3,
705  ellipseName: "Fischer 1968"
706};
707st.helmert = {
708  a: 6378200,
709  rf: 298.3,
710  ellipseName: "Helmert 1906"
711};
712st.hough = {
713  a: 6378270,
714  rf: 297,
715  ellipseName: "Hough"
716};
717st.intl = {
718  a: 6378388,
719  rf: 297,
720  ellipseName: "International 1909 (Hayford)"
721};
722st.kaula = {
723  a: 6378163,
724  rf: 298.24,
725  ellipseName: "Kaula 1961"
726};
727st.lerch = {
728  a: 6378139,
729  rf: 298.257,
730  ellipseName: "Lerch 1979"
731};
732st.mprts = {
733  a: 6397300,
734  rf: 191,
735  ellipseName: "Maupertius 1738"
736};
737st.new_intl = {
738  a: 63781575e-1,
739  b: 63567722e-1,
740  ellipseName: "New International 1967"
741};
742st.plessis = {
743  a: 6376523,
744  rf: 6355863,
745  ellipseName: "Plessis 1817 (France)"
746};
747st.krass = {
748  a: 6378245,
749  rf: 298.3,
750  ellipseName: "Krassovsky, 1942"
751};
752st.SEasia = {
753  a: 6378155,
754  b: 63567733205e-4,
755  ellipseName: "Southeast Asia"
756};
757st.walbeck = {
758  a: 6376896,
759  b: 63558348467e-4,
760  ellipseName: "Walbeck"
761};
762st.WGS60 = {
763  a: 6378165,
764  rf: 298.3,
765  ellipseName: "WGS 60"
766};
767st.WGS66 = {
768  a: 6378145,
769  rf: 298.25,
770  ellipseName: "WGS 66"
771};
772st.WGS7 = {
773  a: 6378135,
774  rf: 298.26,
775  ellipseName: "WGS 72"
776};
777var U_ = st.WGS84 = {
778  a: 6378137,
779  rf: 298.257223563,
780  ellipseName: "WGS 84"
781};
782st.sphere = {
783  a: 6370997,
784  b: 6370997,
785  ellipseName: "Normal Sphere (r=6370997)"
786};
787function X_(e, t, i, s) {
788  var n = e * e, r = t * t, o = (n - r) / n, a = 0;
789  s ? (e *= 1 - o * (u_ + o * (d_ + o * f_)), n = e * e, o = 0) : a = Math.sqrt(o);
790  var l = (n - r) / r;
791  return {
792    es: o,
793    e: a,
794    ep2: l
795  };
796}
797function $_(e, t, i, s, n) {
798  if (!e) {
799    var r = Hi(st, s);
800    r || (r = U_), e = r.a, t = r.b, i = r.rf;
801  }
802  return i && !t && (t = (1 - 1 / i) * e), (i === 0 || Math.abs(e - t) < G) && (n = !0, t = e), {
803    a: e,
804    b: t,
805    rf: i,
806    sphere: n
807  };
808}
809var Kt = {};
810Kt.wgs84 = {
811  towgs84: "0,0,0",
812  ellipse: "WGS84",
813  datumName: "WGS84"
814};
815Kt.ch1903 = {
816  towgs84: "674.374,15.056,405.346",
817  ellipse: "bessel",
818  datumName: "swiss"
819};
820Kt.ggrs87 = {
821  towgs84: "-199.87,74.79,246.62",
822  ellipse: "GRS80",
823  datumName: "Greek_Geodetic_Reference_System_1987"
824};
825Kt.nad83 = {
826  towgs84: "0,0,0",
827  ellipse: "GRS80",
828  datumName: "North_American_Datum_1983"
829};
830Kt.nad27 = {
831  nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
832  ellipse: "clrk66",
833  datumName: "North_American_Datum_1927"
834};
835Kt.potsdam = {
836  towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
837  ellipse: "bessel",
838  datumName: "Potsdam Rauenberg 1950 DHDN"
839};
840Kt.carthage = {
841  towgs84: "-263.0,6.0,431.0",
842  ellipse: "clark80",
843  datumName: "Carthage 1934 Tunisia"
844};
845Kt.hermannskogel = {
846  towgs84: "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
847  ellipse: "bessel",
848  datumName: "Hermannskogel"
849};
850Kt.osni52 = {
851  towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
852  ellipse: "airy",
853  datumName: "Irish National"
854};
855Kt.ire65 = {
856  towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
857  ellipse: "mod_airy",
858  datumName: "Ireland 1965"
859};
860Kt.rassadiran = {
861  towgs84: "-133.63,-157.5,-158.62",
862  ellipse: "intl",
863  datumName: "Rassadiran"
864};
865Kt.nzgd49 = {
866  towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
867  ellipse: "intl",
868  datumName: "New Zealand Geodetic Datum 1949"
869};
870Kt.osgb36 = {
871  towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
872  ellipse: "airy",
873  datumName: "Airy 1830"
874};
875Kt.s_jtsk = {
876  towgs84: "589,76,480",
877  ellipse: "bessel",
878  datumName: "S-JTSK (Ferro)"
879};
880Kt.beduaram = {
881  towgs84: "-106,-87,188",
882  ellipse: "clrk80",
883  datumName: "Beduaram"
884};
885Kt.gunung_segara = {
886  towgs84: "-403,684,41",
887  ellipse: "bessel",
888  datumName: "Gunung Segara Jakarta"
889};
890Kt.rnb72 = {
891  towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
892  ellipse: "intl",
893  datumName: "Reseau National Belge 1972"
894};
895function Y_(e, t, i, s, n, r, o) {
896  var a = {};
897  return e === void 0 || e === "none" ? a.datum_type = sl : a.datum_type = h_, t && (a.datum_params = t.map(parseFloat), (a.datum_params[0] !== 0 || a.datum_params[1] !== 0 || a.datum_params[2] !== 0) && (a.datum_type = vs), a.datum_params.length > 3 && (a.datum_params[3] !== 0 || a.datum_params[4] !== 0 || a.datum_params[5] !== 0 || a.datum_params[6] !== 0) && (a.datum_type = Es, a.datum_params[3] *= Kn, a.datum_params[4] *= Kn, a.datum_params[5] *= Kn, a.datum_params[6] = a.datum_params[6] / 1e6 + 1)), o && (a.datum_type = sn, a.grids = o), a.a = i, a.b = s, a.es = n, a.ep2 = r, a;
898}
899var xd = {};
900function K_(e, t) {
901  var i = new DataView(t), s = H_(i), n = Z_(i, s);
902  n.nSubgrids > 1;
903  var r = J_(i, n, s), o = { header: n, subgrids: r };
904  return xd[e] = o, o;
905}
906function q_(e) {
907  if (e === void 0)
908    return null;
909  var t = e.split(",");
910  return t.map(V_);
911}
912function V_(e) {
913  if (e.length === 0)
914    return null;
915  var t = e[0] === "@";
916  return t && (e = e.slice(1)), e === "null" ? { name: "null", mandatory: !t, grid: null, isNull: !0 } : {
917    name: e,
918    mandatory: !t,
919    grid: xd[e] || null,
920    isNull: !1
921  };
922}
923function qs(e) {
924  return e / 3600 * Math.PI / 180;
925}
926function H_(e) {
927  var t = e.getInt32(8, !1);
928  return t === 11 ? !1 : (t = e.getInt32(8, !0), !0);
929}
930function Z_(e, t) {
931  return {
932    nFields: e.getInt32(8, t),
933    nSubgridFields: e.getInt32(24, t),
934    nSubgrids: e.getInt32(40, t),
935    shiftType: rl(e, 56, 56 + 8).trim(),
936    fromSemiMajorAxis: e.getFloat64(120, t),
937    fromSemiMinorAxis: e.getFloat64(136, t),
938    toSemiMajorAxis: e.getFloat64(152, t),
939    toSemiMinorAxis: e.getFloat64(168, t)
940  };
941}
942function rl(e, t, i) {
943  return String.fromCharCode.apply(null, new Uint8Array(e.buffer.slice(t, i)));
944}
945function J_(e, t, i) {
946  for (var s = 176, n = [], r = 0; r < t.nSubgrids; r++) {
947    var o = tm(e, s, i), a = em(e, s, o, i), l = Math.round(
948      1 + (o.upperLongitude - o.lowerLongitude) / o.longitudeInterval
949    ), h = Math.round(
950      1 + (o.upperLatitude - o.lowerLatitude) / o.latitudeInterval
951    );
952    n.push({
953      ll: [qs(o.lowerLongitude), qs(o.lowerLatitude)],
954      del: [qs(o.longitudeInterval), qs(o.latitudeInterval)],
955      lim: [l, h],
956      count: o.gridNodeCount,
957      cvs: Q_(a)
958    });
959  }
960  return n;
961}
962function Q_(e) {
963  return e.map(function(t) {
964    return [qs(t.longitudeShift), qs(t.latitudeShift)];
965  });
966}
967function tm(e, t, i) {
968  return {
969    name: rl(e, t + 8, t + 16).trim(),
970    parent: rl(e, t + 24, t + 24 + 8).trim(),
971    lowerLatitude: e.getFloat64(t + 72, i),
972    upperLatitude: e.getFloat64(t + 88, i),
973    lowerLongitude: e.getFloat64(t + 104, i),
974    upperLongitude: e.getFloat64(t + 120, i),
975    latitudeInterval: e.getFloat64(t + 136, i),
976    longitudeInterval: e.getFloat64(t + 152, i),
977    gridNodeCount: e.getInt32(t + 168, i)
978  };
979}
980function em(e, t, i, s) {
981  for (var n = t + 176, r = 16, o = [], a = 0; a < i.gridNodeCount; a++) {
982    var l = {
983      latitudeShift: e.getFloat32(n + a * r, s),
984      longitudeShift: e.getFloat32(n + a * r + 4, s),
985      latitudeAccuracy: e.getFloat32(n + a * r + 8, s),
986      longitudeAccuracy: e.getFloat32(n + a * r + 12, s)
987    };
988    o.push(l);
989  }
990  return o;
991}
992function Je(e, t) {
993  if (!(this instanceof Je))
994    return new Je(e);
995  t = t || function(h) {
996    if (h)
997      throw h;
998  };
vendor: 5,637 bytes, lines 999-1160
999  var i = P_(e);
1000  if (typeof i != "object") {
1001    t(e);
1002    return;
1003  }
1004  var s = Je.projections.get(i.projName);
1005  if (!s) {
1006    t(e);
1007    return;
1008  }
1009  if (i.datumCode && i.datumCode !== "none") {
1010    var n = Hi(Kt, i.datumCode);
1011    n && (i.datum_params = i.datum_params || (n.towgs84 ? n.towgs84.split(",") : null), i.ellps = n.ellipse, i.datumName = n.datumName ? n.datumName : i.datumCode);
1012  }
1013  i.k0 = i.k0 || 1, i.axis = i.axis || "enu", i.ellps = i.ellps || "wgs84", i.lat1 = i.lat1 || i.lat0;
1014  var r = $_(i.a, i.b, i.rf, i.ellps, i.sphere), o = X_(r.a, r.b, r.rf, i.R_A), a = q_(i.nadgrids), l = i.datum || Y_(
1015    i.datumCode,
1016    i.datum_params,
1017    r.a,
1018    r.b,
1019    o.es,
1020    o.ep2,
1021    a
1022  );
1023  pc(this, i), pc(this, s), this.a = r.a, this.b = r.b, this.rf = r.rf, this.sphere = r.sphere, this.es = o.es, this.e = o.e, this.ep2 = o.ep2, this.datum = l, this.init(), t(null, this);
1024}
1025Je.projections = B_;
1026Je.projections.start();
1027function im(e, t) {
1028  return e.datum_type !== t.datum_type || e.a !== t.a || Math.abs(e.es - t.es) > 5e-11 ? !1 : e.datum_type === vs ? e.datum_params[0] === t.datum_params[0] && e.datum_params[1] === t.datum_params[1] && e.datum_params[2] === t.datum_params[2] : e.datum_type === Es ? e.datum_params[0] === t.datum_params[0] && e.datum_params[1] === t.datum_params[1] && e.datum_params[2] === t.datum_params[2] && e.datum_params[3] === t.datum_params[3] && e.datum_params[4] === t.datum_params[4] && e.datum_params[5] === t.datum_params[5] && e.datum_params[6] === t.datum_params[6] : !0;
1029}
1030function vd(e, t, i) {
1031  var s = e.x, n = e.y, r = e.z ? e.z : 0, o, a, l, h;
1032  if (n < -A && n > -1.001 * A)
1033    n = -A;
1034  else if (n > A && n < 1.001 * A)
1035    n = A;
1036  else {
1037    if (n < -A)
1038      return { x: -1 / 0, y: -1 / 0, z: e.z };
1039    if (n > A)
1040      return { x: 1 / 0, y: 1 / 0, z: e.z };
1041  }
1042  return s > Math.PI && (s -= 2 * Math.PI), a = Math.sin(n), h = Math.cos(n), l = a * a, o = i / Math.sqrt(1 - t * l), {
1043    x: (o + r) * h * Math.cos(s),
1044    y: (o + r) * h * Math.sin(s),
1045    z: (o * (1 - t) + r) * a
1046  };
1047}
1048function Ed(e, t, i, s) {
1049  var n = 1e-12, r = n * n, o = 30, a, l, h, c, u, d, f, g, _, m, p, y, v, E = e.x, C = e.y, w = e.z ? e.z : 0, O, R, j;
1050  if (a = Math.sqrt(E * E + C * C), l = Math.sqrt(E * E + C * C + w * w), a / i < n) {
1051    if (O = 0, l / i < n)
1052      return R = A, j = -s, {
1053        x: e.x,
1054        y: e.y,
1055        z: e.z
1056      };
1057  } else
1058    O = Math.atan2(C, E);
1059  h = w / l, c = a / l, u = 1 / Math.sqrt(1 - t * (2 - t) * c * c), g = c * (1 - t) * u, _ = h * u, v = 0;
1060  do
1061    v++, f = i / Math.sqrt(1 - t * _ * _), j = a * g + w * _ - f * (1 - t * _ * _), d = t * f / (f + j), u = 1 / Math.sqrt(1 - d * (2 - d) * c * c), m = c * (1 - d) * u, p = h * u, y = p * g - m * _, g = m, _ = p;
1062  while (y * y > r && v < o);
1063  return R = Math.atan(p / Math.abs(m)), {
1064    x: O,
1065    y: R,
1066    z: j
1067  };
1068}
1069function sm(e, t, i) {
1070  if (t === vs)
1071    return {
1072      x: e.x + i[0],
1073      y: e.y + i[1],
1074      z: e.z + i[2]
1075    };
1076  if (t === Es) {
1077    var s = i[0], n = i[1], r = i[2], o = i[3], a = i[4], l = i[5], h = i[6];
1078    return {
1079      x: h * (e.x - l * e.y + a * e.z) + s,
1080      y: h * (l * e.x + e.y - o * e.z) + n,
1081      z: h * (-a * e.x + o * e.y + e.z) + r
1082    };
1083  }
1084}
1085function nm(e, t, i) {
1086  if (t === vs)
1087    return {
1088      x: e.x - i[0],
1089      y: e.y - i[1],
1090      z: e.z - i[2]
1091    };
1092  if (t === Es) {
1093    var s = i[0], n = i[1], r = i[2], o = i[3], a = i[4], l = i[5], h = i[6], c = (e.x - s) / h, u = (e.y - n) / h, d = (e.z - r) / h;
1094    return {
1095      x: c + l * u - a * d,
1096      y: -l * c + u + o * d,
1097      z: a * c - o * u + d
1098    };
1099  }
1100}
1101function jr(e) {
1102  return e === vs || e === Es;
1103}
1104function rm(e, t, i) {
1105  if (im(e, t) || e.datum_type === sl || t.datum_type === sl)
1106    return i;
1107  var s = e.a, n = e.es;
1108  if (e.datum_type === sn) {
1109    var r = xc(e, !1, i);
1110    if (r !== 0)
1111      return;
1112    s = fc, n = gc;
1113  }
1114  var o = t.a, a = t.b, l = t.es;
1115  if (t.datum_type === sn && (o = fc, a = c_, l = gc), n === l && s === o && !jr(e.datum_type) && !jr(t.datum_type))
1116    return i;
1117  if (i = vd(i, n, s), jr(e.datum_type) && (i = sm(i, e.datum_type, e.datum_params)), jr(t.datum_type) && (i = nm(i, t.datum_type, t.datum_params)), i = Ed(i, l, o, a), t.datum_type === sn) {
1118    var h = xc(t, !0, i);
1119    if (h !== 0)
1120      return;
1121  }
1122  return i;
1123}
1124function xc(e, t, i) {
1125  if (e.grids === null || e.grids.length === 0)
1126    return -1;
1127  for (var s = { x: -i.x, y: i.y }, n = { x: Number.NaN, y: Number.NaN }, r = [], o = 0; o < e.grids.length; o++) {
1128    var a = e.grids[o];
1129    if (r.push(a.name), a.isNull) {
1130      n = s;
1131      break;
1132    }
1133    if (a.mandatory, a.grid === null) {
1134      if (a.mandatory)
1135        return -1;
1136      continue;
1137    }
1138    var l = a.grid.subgrids[0], h = (Math.abs(l.del[1]) + Math.abs(l.del[0])) / 1e4, c = l.ll[0] - h, u = l.ll[1] - h, d = l.ll[0] + (l.lim[0] - 1) * l.del[0] + h, f = l.ll[1] + (l.lim[1] - 1) * l.del[1] + h;
1139    if (!(u > s.y || c > s.x || f < s.y || d < s.x) && (n = om(s, t, l), !isNaN(n.x)))
1140      break;
1141  }
1142  return isNaN(n.x) ? -1 : (i.x = -n.x, i.y = n.y, 0);
1143}
1144function om(e, t, i) {
1145  var s = { x: Number.NaN, y: Number.NaN };
1146  if (isNaN(e.x))
1147    return s;
1148  var n = { x: e.x, y: e.y };
1149  n.x -= i.ll[0], n.y -= i.ll[1], n.x = U(n.x - Math.PI) + Math.PI;
1150  var r = vc(n, i);
1151  if (t) {
1152    if (isNaN(r.x))
1153      return s;
1154    r.x = n.x - r.x, r.y = n.y - r.y;
1155    var o = 9, a = 1e-12, l, h;
1156    do {
1157      if (h = vc(r, i), isNaN(h.x))
1158        break;
1159      l = { x: n.x - (h.x + r.x), y: n.y - (h.y + r.y) }, r.x += l.x, r.y += l.y;
1160    } while (o-- && Math.abs(l.x) >
1160 a && Math.abs(l.y) > a);
1161    if (o < 0)
1162      return s;
1163    s.x = U(r.x + i.ll[0]), s.y = r.y + i.ll[1];
1164  } else
1165    isNaN(r.x) || (s.x = e.x + r.x, s.y = e.y + r.y);
1166  return s;
1167}
1168function vc(e, t) {
1169  var i = { x: e.x / t.del[0], y: e.y / t.del[1] }, s = { x: Math.floor(i.x), y: Math.floor(i.y) }, n = { x: i.x - 1 * s.x, y: i.y - 1 * s.y }, r = { x: Number.NaN, y: Number.NaN }, o;
1170  if (s.x < 0 || s.x >= t.lim[0] || s.y < 0 || s.y >= t.lim[1])
1171    return r;
1172  o = s.y * t.lim[0] + s.x;
1173  var a = { x: t.cvs[o][0], y: t.cvs[o][1] };
1174  o++;
1175  var l = { x: t.cvs[o][0], y: t.cvs[o][1] };
1176  o += t.lim[0];
1177  var h = { x: t.cvs[o][0], y: t.cvs[o][1] };
1178  o--;
1179  var c = { x: t.cvs[o][0], y: t.cvs[o][1] }, u = n.x * n.y, d = n.x * (1 - n.y), f = (1 - n.x) * (1 - n.y), g = (1 - n.x) * n.y;
1180  return r.x = f * a.x + d * l.x + g * c.x + u * h.x, r.y = f * a.y + d * l.y + g * c.y + u * h.y, r;
1181}
1182function Ec(e, t, i) {
1183  var s = i.x, n = i.y, r = i.z || 0, o, a, l, h = {};
1184  for (l = 0; l < 3; l++)
1185    if (!(t && l === 2 && i.z === void 0))
1186      switch (l === 0 ? (o = s, "ew".indexOf(e.axis[l]) !== -1 ? a = "x" : a = "y") : l === 1 ? (o = n, "ns".indexOf(e.axis[l]) !== -1 ? a = "y" : a = "x") : (o = r, a = "z"), e.axis[l]) {
1187        case "e":
1188          h[a] = o;
1189          break;
1190        case "w":
1191          h[a] = -o;
1192          break;
1193        case "n":
1194          h[a] = o;
1195          break;
1196        case "s":
1197          h[a] = -o;
1198          break;
1199        case "u":
1200          i[a] !== void 0 && (h.z = o);
1201          break;
1202        case "d":
1203          i[a] !== void 0 && (h.z = -o);
1204          break;
1205        default:
1206          return null;
1207      }
1208  return h;
1209}
1210function Md(e) {
1211  var t = {
1212    x: e[0],
1213    y: e[1]
1214  };
1215  return e.length > 2 && (t.z = e[2]), e.length > 3 && (t.m = e[3]), t;
1216}
1217function am(e) {
1218  Mc(e.x), Mc(e.y);
1219}
1220function Mc(e) {
1221  if (typeof Number.isFinite == "function") {
1222    if (Number.isFinite(e))
1223      return;
1224    throw new TypeError("coordinates must be finite numbers");
1225  }
1226  if (typeof e != "number" || e !== e || !isFinite(e))
1227    throw new TypeError("coordinates must be finite numbers");
1228}
1229function lm(e, t) {
1230  return (e.datum.datum_type === vs || e.datum.datum_type === Es || e.datum.datum_type === sn) && t.datumCode !== "WGS84" || (t.datum.datum_type === vs || t.datum.datum_type === Es || t.datum.datum_type === sn) && e.datumCode !== "WGS84";
1231}
1232function Eo(e, t, i, s) {
1233  var n;
1234  Array.isArray(i) ? i = Md(i) : i = {
1235    x: i.x,
1236    y: i.y,
1237    z: i.z,
1238    m: i.m
1239  };
1240  var r = i.z !== void 0;
1241  if (am(i), e.datum && t.datum && lm(e, t) && (n = new Je("WGS84"), i = Eo(e, n, i, s), e = n), s && e.axis !== "enu" && (i = Ec(e, !1, i)), e.projName === "longlat")
1242    i = {
1243      x: i.x * qt,
1244      y: i.y * qt,
1245      z: i.z || 0
1246    };
1247  else if (e.to_meter && (i = {
1248    x: i.x * e.to_meter,
1249    y: i.y * e.to_meter,
1250    z: i.z || 0
1251  }), i = e.inverse(i), !i)
1252    return;
1253  if (e.from_greenwich && (i.x += e.from_greenwich), i = rm(e.datum, t.datum, i), !!i)
1254    return t.from_greenwich && (i = {
1255      x: i.x - t.from_greenwich,
1256      y: i.y,
1257      z: i.z || 0
1258    }), t.projName === "longlat" ? i = {
1259      x: i.x * Ni,
1260      y: i.y * Ni,
1261      z: i.z || 0
1262    } : (i = t.forward(i), t.to_meter && (i = {
1263      x: i.x / t.to_meter,
1264      y: i.y / t.to_meter,
1265      z: i.z || 0
1266    })), s && t.axis !== "enu" ? Ec(t, !0, i) : (r || delete i.z, i);
1267}
1268var Cc = Je("WGS84");
1269function ba(e, t, i, s) {
1270  var n, r, o;
1271  return Array.isArray(i) ? (n = Eo(e, t, i, s) || { x: NaN, y: NaN }, i.length > 2 ? typeof e.name < "u" && e.name === "geocent" || typeof t.name < "u" && t.name === "geocent" ? typeof n.z == "number" ? [n.x, n.y, n.z].concat(i.splice(3)) : [n.x, n.y, i[2]].concat(i.splice(3)) : [n.x, n.y].concat(i.splice(2)) : [n.x, n.y]) : (r = Eo(e, t, i, s), o = Object.keys(i), o.length === 2 || o.forEach(function(a) {
1272    if (typeof e.name < "u" && e.name === "geocent" || typeof t.name < "u" && t.name === "geocent") {
1273      if (a === "x" || a === "y" || a === "z")
1274        return;
1275    } else if (a === "x" || a === "y")
1276      return;
1277    r[a] = i[a];
1278  }), r);
1279}
1280function bc(e) {
1281  return e instanceof Je ? e : e.oProj ? e.oProj : Je(e);
1282}
1283function xe(e, t, i) {
1284  e = bc(e);
1285  var s = !1, n;
1286  return typeof t > "u" ? (t = e, e = Cc, s = !0) : (typeof t.x < "u" || Array.isArray(t)) && (i = t, t = e, e = Cc, s = !0), t = bc(t), i ? ba(e, t, i) : (n = {
1287    forward: function(r, o) {
1288      return ba(e, t, r, o);
1289    },
1290    inverse: function(r, o) {
1291      return ba(t, e, r, o);
1292    }
1293  }, s && (n.oProj = t), n);
1294}
1295var wc = 6, Cd = "AJSAJS", bd = "AFAFAF", Vs = 65, ge = 73, Ie = 79, jn = 86, Wn = 90;
1296const hm = {
1297  forward: wd,
1298  inverse: cm,
1299  toPoint: Sd
1300};
1301function wd(e, t) {
1302  return t = t || 5, fm(um({
1303    lat: e[1],
1304    lon: e[0]
1305  }), t);
1306}
1307function cm(e) {
1308  var t = Xl(Rd(e.toUpperCase()));
1309  return t.lat && t.lon ? [t.lon, t.lat, t.lon, t.lat] : [t.left, t.bottom, t.right, t.top];
1310}
1311function Sd(e) {
1312  var t = Xl(Rd(e.toUpperCase()));
1313  return t.lat && t.lon ? [t.lon, t.lat] : [(t.left + t.right) / 2, (t.top + t.bottom) / 2];
1314}
1315function wa(e) {
1316  return e * (Math.PI / 180);
1317}
1318function Sc(e) {
1319  return 180 * (e / Math.PI);
1320}
1321function um(e) {
1322  var t = e.lat, i = e.lon, s = 6378137, n = 669438e-8, r = 0.9996, o, a, l, h, c, u, d, f = wa(t), g = wa(i), _, m;
1323  m = Math.floor((i + 180) / 6) + 1, i === 180 && (m = 60), t >= 56 && t < 64 && i >= 3 && i < 12 && (m = 32), t >= 72 && t < 84 && (i >= 0 && i < 9 ? m = 31 : i >= 9 && i < 21 ? m = 33 : i >= 21 && i < 33 ? m = 35 : i >= 33 && i < 42 && (m = 37)), o = (m - 1) * 6 - 180 + 3, _ = wa(o), a = n / (1 - n), l = s / Math.sqrt(1 - n * Math.sin(f) * Math.sin(f)), h = Math.tan(f) * Math.tan(f), c = a * Math.cos(f) * Math.cos(f), u = Math.
vendor: 58,935 bytes, lines 1323-2424
1323cos(f) * (g - _), d = s * ((1 - n / 4 - 3 * n * n / 64 - 5 * n * n * n / 256) * f - (3 * n / 8 + 3 * n * n / 32 + 45 * n * n * n / 1024) * Math.sin(2 * f) + (15 * n * n / 256 + 45 * n * n * n / 1024) * Math.sin(4 * f) - 35 * n * n * n / 3072 * Math.sin(6 * f));
1324  var p = r * l * (u + (1 - h + c) * u * u * u / 6 + (5 - 18 * h + h * h + 72 * c - 58 * a) * u * u * u * u * u / 120) + 5e5, y = r * (d + l * Math.tan(f) * (u * u / 2 + (5 - h + 9 * c + 4 * c * c) * u * u * u * u / 24 + (61 - 58 * h + h * h + 600 * c - 330 * a) * u * u * u * u * u * u / 720));
1325  return t < 0 && (y += 1e7), {
1326    northing: Math.round(y),
1327    easting: Math.round(p),
1328    zoneNumber: m,
1329    zoneLetter: dm(t)
1330  };
1331}
1332function Xl(e) {
1333  var t = e.northing, i = e.easting, s = e.zoneLetter, n = e.zoneNumber;
1334  if (n < 0 || n > 60)
1335    return null;
1336  var r = 0.9996, o = 6378137, a = 669438e-8, l, h = (1 - Math.sqrt(1 - a)) / (1 + Math.sqrt(1 - a)), c, u, d, f, g, _, m, p, y, v = i - 5e5, E = t;
1337  s < "N" && (E -= 1e7), m = (n - 1) * 6 - 180 + 3, l = a / (1 - a), _ = E / r, p = _ / (o * (1 - a / 4 - 3 * a * a / 64 - 5 * a * a * a / 256)), y = p + (3 * h / 2 - 27 * h * h * h / 32) * Math.sin(2 * p) + (21 * h * h / 16 - 55 * h * h * h * h / 32) * Math.sin(4 * p) + 151 * h * h * h / 96 * Math.sin(6 * p), c = o / Math.sqrt(1 - a * Math.sin(y) * Math.sin(y)), u = Math.tan(y) * Math.tan(y), d = l * Math.cos(y) * Math.cos(y), f = o * (1 - a) / Math.pow(1 - a * Math.sin(y) * Math.sin(y), 1.5), g = v / (c * r);
1338  var C = y - c * Math.tan(y) / f * (g * g / 2 - (5 + 3 * u + 10 * d - 4 * d * d - 9 * l) * g * g * g * g / 24 + (61 + 90 * u + 298 * d + 45 * u * u - 252 * l - 3 * d * d) * g * g * g * g * g * g / 720);
1339  C = Sc(C);
1340  var w = (g - (1 + 2 * u + d) * g * g * g / 6 + (5 - 2 * d + 28 * u - 3 * d * d + 8 * l + 24 * u * u) * g * g * g * g * g / 120) / Math.cos(y);
1341  w = m + Sc(w);
1342  var O;
1343  if (e.accuracy) {
1344    var R = Xl({
1345      northing: e.northing + e.accuracy,
1346      easting: e.easting + e.accuracy,
1347      zoneLetter: e.zoneLetter,
1348      zoneNumber: e.zoneNumber
1349    });
1350    O = {
1351      top: R.lat,
1352      right: R.lon,
1353      bottom: C,
1354      left: w
1355    };
1356  } else
1357    O = {
1358      lat: C,
1359      lon: w
1360    };
1361  return O;
1362}
1363function dm(e) {
1364  var t = "Z";
1365  return 84 >= e && e >= 72 ? t = "X" : 72 > e && e >= 64 ? t = "W" : 64 > e && e >= 56 ? t = "V" : 56 > e && e >= 48 ? t = "U" : 48 > e && e >= 40 ? t = "T" : 40 > e && e >= 32 ? t = "S" : 32 > e && e >= 24 ? t = "R" : 24 > e && e >= 16 ? t = "Q" : 16 > e && e >= 8 ? t = "P" : 8 > e && e >= 0 ? t = "N" : 0 > e && e >= -8 ? t = "M" : -8 > e && e >= -16 ? t = "L" : -16 > e && e >= -24 ? t = "K" : -24 > e && e >= -32 ? t = "J" : -32 > e && e >= -40 ? t = "H" : -40 > e && e >= -48 ? t = "G" : -48 > e && e >= -56 ? t = "F" : -56 > e && e >= -64 ? t = "E" : -64 > e && e >= -72 ? t = "D" : -72 > e && e >= -80 && (t = "C"), t;
1366}
1367function fm(e, t) {
1368  var i = "00000" + e.easting, s = "00000" + e.northing;
1369  return e.zoneNumber + e.zoneLetter + gm(e.easting, e.northing, e.zoneNumber) + i.substr(i.length - 5, t) + s.substr(s.length - 5, t);
1370}
1371function gm(e, t, i) {
1372  var s = Td(i), n = Math.floor(e / 1e5), r = Math.floor(t / 1e5) % 20;
1373  return _m(n, r, s);
1374}
1375function Td(e) {
1376  var t = e % wc;
1377  return t === 0 && (t = wc), t;
1378}
1379function _m(e, t, i) {
1380  var s = i - 1, n = Cd.charCodeAt(s), r = bd.charCodeAt(s), o = n + e - 1, a = r + t, l = !1;
1381  o > Wn && (o = o - Wn + Vs - 1, l = !0), (o === ge || n < ge && o > ge || (o > ge || n < ge) && l) && o++, (o === Ie || n < Ie && o > Ie || (o > Ie || n < Ie) && l) && (o++, o === ge && o++), o > Wn && (o = o - Wn + Vs - 1), a > jn ? (a = a - jn + Vs - 1, l = !0) : l = !1, (a === ge || r < ge && a > ge || (a > ge || r < ge) && l) && a++, (a === Ie || r < Ie && a > Ie || (a > Ie || r < Ie) && l) && (a++, a === ge && a++), a > jn && (a = a - jn + Vs - 1);
1382  var h = String.fromCharCode(o) + String.fromCharCode(a);
1383  return h;
1384}
1385function Rd(e) {
1386  if (e && e.length === 0)
1387    throw "MGRSPoint coverting from nothing";
1388  for (var t = e.length, i = null, s = "", n, r = 0; !/[A-Z]/.test(n = e.charAt(r)); ) {
1389    if (r >= 2)
1390      throw "MGRSPoint bad conversion from: " + e;
1391    s += n, r++;
1392  }
1393  var o = parseInt(s, 10);
1394  if (r === 0 || r + 3 > t)
1395    throw "MGRSPoint bad conversion from: " + e;
1396  var a = e.charAt(r++);
1397  if (a <= "A" || a === "B" || a === "Y" || a >= "Z" || a === "I" || a === "O")
1398    throw "MGRSPoint zone letter " + a + " not handled: " + e;
1399  i = e.substring(r, r += 2);
1400  for (var l = Td(o), h = mm(i.charAt(0), l), c = pm(i.charAt(1), l); c < ym(a); )
1401    c += 2e6;
1402  var u = t - r;
1403  if (u % 2 !== 0)
1404    throw `MGRSPoint has to have an even number 
1405of digits after the zone letter and two 100km letters - front 
1406half for easting meters, second half for 
1407northing meters` + e;
1408  var d = u / 2, f = 0, g = 0, _, m, p, y, v;
1409  return d > 0 && (_ = 1e5 / Math.pow(10, d), m = e.substring(r, r + d), f = parseFloat(m) * _, p = e.substring(r + d), g = parseFloat(p) * _), y = f + h, v = g + c, {
1410    easting: y,
1411    northing: v,
1412    zoneLetter: a,
1413    zoneNumber: o,
1414    accuracy: _
1415  };
1416}
1417function mm(e, t) {
1418  for (var i = Cd.charCodeAt(t - 1), s = 1e5, n = !1; i !== e.charCodeAt(0); ) {
1419    if (i++, i === ge && i++, i === Ie && i++, i > Wn) {
1420      if (n)
1421        throw "Bad character: " + e;
1422      i = Vs, n = !0;
1423    }
1424    s += 1e5;
1425  }
1426  return s;
1427}
1428function pm(e, t) {
1429  if (e > "V")
1430    throw "MGRSPoint given invalid Northing " + e;
1431  for (var i = bd.charCodeAt(t - 1), s = 0, n = !1; i !== e.charCodeAt(0); ) {
1432    if (i++, i === ge && i++, i === Ie && i++, i > jn) {
1433      if (n)
1434        throw "Bad character: " + e;
1435      i = Vs, n = !0;
1436    }
1437    s += 1e5;
1438  }
1439  return s;
1440}
1441function ym(e) {
1442  var t;
1443  switch (e) {
1444    case "C":
1445      t = 11e5;
1446      break;
1447    case "D":
1448      t = 2e6;
1449      break;
1450    case "E":
1451      t = 28e5;
1452      break;
1453    case "F":
1454      t = 37e5;
1455      break;
1456    case "G":
1457      t = 46e5;
1458      break;
1459    case "H":
1460      t = 55e5;
1461      break;
1462    case "J":
1463      t = 64e5;
1464      break;
1465    case "K":
1466      t = 73e5;
1467      break;
1468    case "L":
1469      t = 82e5;
1470      break;
1471    case "M":
1472      t = 91e5;
1473      break;
1474    case "N":
1475      t = 0;
1476      break;
1477    case "P":
1478      t = 8e5;
1479      break;
1480    case "Q":
1481      t = 17e5;
1482      break;
1483    case "R":
1484      t = 26e5;
1485      break;
1486    case "S":
1487      t = 35e5;
1488      break;
1489    case "T":
1490      t = 44e5;
1491      break;
1492    case "U":
1493      t = 53e5;
1494      break;
1495    case "V":
1496      t = 62e5;
1497      break;
1498    case "W":
1499      t = 7e6;
1500      break;
1501    case "X":
1502      t = 79e5;
1503      break;
1504    default:
1505      t = -1;
1506  }
1507  if (t >= 0)
1508    return t;
1509  throw "Invalid zone letter: " + e;
1510}
1511function fn(e, t, i) {
1512  if (!(this instanceof fn))
1513    return new fn(e, t, i);
1514  if (Array.isArray(e))
1515    this.x = e[0], this.y = e[1], this.z = e[2] || 0;
1516  else if (typeof e == "object")
1517    this.x = e.x, this.y = e.y, this.z = e.z || 0;
1518  else if (typeof e == "string" && typeof t > "u") {
1519    var s = e.split(",");
1520    this.x = parseFloat(s[0], 10), this.y = parseFloat(s[1], 10), this.z = parseFloat(s[2], 10) || 0;
1521  } else
1522    this.x = e, this.y = t, this.z = i || 0;
1523}
1524fn.fromMGRS = function(e) {
1525  return new fn(Sd(e));
1526};
1527fn.prototype.toMGRS = function(e) {
1528  return wd([this.x, this.y], e);
1529};
1530var xm = 1, vm = 0.25, Tc = 0.046875, Rc = 0.01953125, Ic = 0.01068115234375, Em = 0.75, Mm = 0.46875, Cm = 0.013020833333333334, bm = 0.007120768229166667, wm = 0.3645833333333333, Sm = 0.005696614583333333, Tm = 0.3076171875;
1531function Id(e) {
1532  var t = [];
1533  t[0] = xm - e * (vm + e * (Tc + e * (Rc + e * Ic))), t[1] = e * (Em - e * (Tc + e * (Rc + e * Ic)));
1534  var i = e * e;
1535  return t[2] = i * (Mm - e * (Cm + e * bm)), i *= e, t[3] = i * (wm - e * Sm), t[4] = i * e * Tm, t;
1536}
1537function qo(e, t, i, s) {
1538  return i *= t, t *= t, s[0] * e - i * (s[1] + t * (s[2] + t * (s[3] + t * s[4])));
1539}
1540var Rm = 20;
1541function Pd(e, t, i) {
1542  for (var s = 1 / (1 - t), n = e, r = Rm; r; --r) {
1543    var o = Math.sin(n), a = 1 - t * o * o;
1544    if (a = (qo(n, o, Math.cos(n), i) - e) * (a * Math.sqrt(a)) * s, n -= a, Math.abs(a) < G)
1545      return n;
1546  }
1547  return n;
1548}
1549function Im() {
1550  this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.es && (this.en = Id(this.es), this.ml0 = qo(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en));
1551}
1552function Pm(e) {
1553  var t = e.x, i = e.y, s = U(t - this.long0), n, r, o, a = Math.sin(i), l = Math.cos(i);
1554  if (this.es) {
1555    var c = l * s, u = Math.pow(c, 2), d = this.ep2 * Math.pow(l, 2), f = Math.pow(d, 2), g = Math.abs(l) > G ? Math.tan(i) : 0, _ = Math.pow(g, 2), m = Math.pow(_, 2);
1556    n = 1 - this.es * Math.pow(a, 2), c = c / Math.sqrt(n);
1557    var p = qo(i, a, l, this.en);
1558    r = this.a * (this.k0 * c * (1 + u / 6 * (1 - _ + d + u / 20 * (5 - 18 * _ + m + 14 * d - 58 * _ * d + u / 42 * (61 + 179 * m - m * _ - 479 * _))))) + this.x0, o = this.a * (this.k0 * (p - this.ml0 + a * s * c / 2 * (1 + u / 12 * (5 - _ + 9 * d + 4 * f + u / 30 * (61 + m - 58 * _ + 270 * d - 330 * _ * d + u / 56 * (1385 + 543 * m - m * _ - 3111 * _)))))) + this.y0;
1559  } else {
1560    var h = l * Math.sin(s);
1561    if (Math.abs(Math.abs(h) - 1) < G)
1562      return 93;
1563    if (r = 0.5 * this.a * this.k0 * Math.log((1 + h) / (1 - h)) + this.x0, o = l * Math.cos(s) / Math.sqrt(1 - Math.pow(h, 2)), h = Math.abs(o), h >= 1) {
1564      if (h - 1 > G)
1565        return 93;
1566      o = 0;
1567    } else
1568      o = Math.acos(o);
1569    i < 0 && (o = -o), o = this.a * this.k0 * (o - this.lat0) + this.y0;
1570  }
1571  return e.x = r, e.y = o, e;
1572}
1573function Am(e) {
1574  var t, i, s, n, r = (e.x - this.x0) * (1 / this.a), o = (e.y - this.y0) * (1 / this.a);
1575  if (this.es)
1576    if (t = this.ml0 + o / this.k0, i = Pd(t, this.es, this.en), Math.abs(i) < A) {
1577      var u = Math.sin(i), d = Math.cos(i), f = Math.abs(d) > G ? Math.tan(i) : 0, g = this.ep2 * Math.pow(d, 2), _ = Math.pow(g, 2), m = Math.pow(f, 2), p = Math.pow(m, 2);
1578      t = 1 - this.es * Math.pow(u, 2);
1579      var y = r * Math.sqrt(t) / this.k0, v = Math.pow(y, 2);
1580      t = t * f, s = i - t * v / (1 - this.es) * 0.5 * (1 - v / 12 * (5 + 3 * m - 9 * g * m + g - 4 * _ - v / 30 * (61 + 90 * m - 252 * g * m + 45 * p + 46 * g - v / 56 * (1385 + 3633 * m + 4095 * p + 1574 * p * m)))), n = U(this.long0 + y * (1 - v / 6 * (1 + 2 * m + g - v / 20 * (5 + 28 * m + 24 * p + 8 * g * m + 6 * g - v / 42 * (61 + 662 * m + 1320 * p + 720 * p * m)))) / d);
1581    } else
1582      s = A * Er(o), n = 0;
1583  else {
1584    var a = Math.exp(r / this.k0), l = 0.5 * (a - 1 / a), h = this.lat0 + o / this.k0, c = Math.cos(h);
1585    t = Math.sqrt((1 - Math.pow(c, 2)) / (1 + Math.pow(l, 2))), s = Math.asin(t), o < 0 && (s = -s), l === 0 && c === 0 ? n = 0 : n = U(Math.atan2(l, c) + this.long0);
1586  }
1587  return e.x = n, e.y = s, e;
1588}
1589var Lm = ["Fast_Transverse_Mercator", "Fast Transverse Mercator"];
1590const uo = {
1591  init: Im,
1592  forward: Pm,
1593  inverse: Am,
1594  names: Lm
1595};
1596function Ad(e) {
1597  var t = Math.exp(e);
1598  return t = (t - 1 / t) / 2, t;
1599}
1600function ke(e, t) {
1601  e = Math.abs(e), t = Math.abs(t);
1602  var i = Math.max(e, t), s = Math.min(e, t) / (i || 1);
1603  return i * Math.sqrt(1 + Math.pow(s, 2));
1604}
1605function Om(e) {
1606  var t = 1 + e, i = t - 1;
1607  return i === 0 ? e : e * Math.log(t) / i;
1608}
1609function Fm(e) {
1610  var t = Math.abs(e);
1611  return t = Om(t * (1 + t / (ke(1, t) + 1))), e < 0 ? -t : t;
1612}
1613function $l(e, t) {
1614  for (var i = 2 * Math.cos(2 * t), s = e.length - 1, n = e[s], r = 0, o; --s >= 0; )
1615    o = -r + i * n + e[s], r = n, n = o;
1616  return t + o * Math.sin(2 * t);
1617}
1618function km(e, t) {
1619  for (var i = 2 * Math.cos(t), s = e.length - 1, n = e[s], r = 0, o; --s >= 0; )
1620    o = -r + i * n + e[s], r = n, n = o;
1621  return Math.sin(t) * o;
1622}
1623function Dm(e) {
1624  var t = Math.exp(e);
1625  return t = (t + 1 / t) / 2, t;
1626}
1627function Ld(e, t, i) {
1628  for (var s = Math.sin(t), n = Math.cos(t), r = Ad(i), o = Dm(i), a = 2 * n * o, l = -2 * s * r, h = e.length - 1, c = e[h], u = 0, d = 0, f = 0, g, _; --h >= 0; )
1629    g = d, _ = u, d = c, u = f, c = -g + a * d - l * u + e[h], f = -_ + l * d + a * u;
1630  return a = s * o, l = n * r, [a * c - l * f, a * f + l * c];
1631}
1632function Nm() {
1633  if (!this.approx && (isNaN(this.es) || this.es <= 0))
1634    throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
1635  this.approx && (uo.init.apply(this), this.forward = uo.forward, this.inverse = uo.inverse), this.x0 = this.x0 !== void 0 ? this.x0 : 0, this.y0 = this.y0 !== void 0 ? this.y0 : 0, this.long0 = this.long0 !== void 0 ? this.long0 : 0, this.lat0 = this.lat0 !== void 0 ? this.lat0 : 0, this.cgb = [], this.cbg = [], this.utg = [], this.gtu = [];
1636  var e = this.es / (1 + Math.sqrt(1 - this.es)), t = e / (2 - e), i = t;
1637  this.cgb[0] = t * (2 + t * (-2 / 3 + t * (-2 + t * (116 / 45 + t * (26 / 45 + t * (-2854 / 675)))))), this.cbg[0] = t * (-2 + t * (2 / 3 + t * (4 / 3 + t * (-82 / 45 + t * (32 / 45 + t * (4642 / 4725)))))), i = i * t, this.cgb[1] = i * (7 / 3 + t * (-8 / 5 + t * (-227 / 45 + t * (2704 / 315 + t * (2323 / 945))))), this.cbg[1] = i * (5 / 3 + t * (-16 / 15 + t * (-13 / 9 + t * (904 / 315 + t * (-1522 / 945))))), i = i * t, this.cgb[2] = i * (56 / 15 + t * (-136 / 35 + t * (-1262 / 105 + t * (73814 / 2835)))), this.cbg[2] = i * (-26 / 15 + t * (34 / 21 + t * (8 / 5 + t * (-12686 / 2835)))), i = i * t, this.cgb[3] = i * (4279 / 630 + t * (-332 / 35 + t * (-399572 / 14175))), this.cbg[3] = i * (1237 / 630 + t * (-12 / 5 + t * (-24832 / 14175))), i = i * t, this.cgb[4] = i * (4174 / 315 + t * (-144838 / 6237)), this.cbg[4] = i * (-734 / 315 + t * (109598 / 31185)), i = i * t, this.cgb[5] = i * (601676 / 22275), this.cbg[5] = i * (444337 / 155925), i = Math.pow(t, 2), this.Qn = this.k0 / (1 + t) * (1 + i * (1 / 4 + i * (1 / 64 + i / 256))), this.utg[0] = t * (-0.5 + t * (2 / 3 + t * (-37 / 96 + t * (1 / 360 + t * (81 / 512 + t * (-96199 / 604800)))))), this.gtu[0] = t * (0.5 + t * (-2 / 3 + t * (5 / 16 + t * (41 / 180 + t * (-127 / 288 + t * (7891 / 37800)))))), this.utg[1] = i * (-1 / 48 + t * (-1 / 15 + t * (437 / 1440 + t * (-46 / 105 + t * (1118711 / 3870720))))), this.gtu[1] = i * (13 / 48 + t * (-3 / 5 + t * (557 / 1440 + t * (281 / 630 + t * (-1983433 / 1935360))))), i = i * t, this.utg[2] = i * (-17 / 480 + t * (37 / 840 + t * (209 / 4480 + t * (-5569 / 90720)))), this.gtu[2] = i * (61 / 240 + t * (-103 / 140 + t * (15061 / 26880 + t * (167603 / 181440)))), i = i * t, this.utg[3] = i * (-4397 / 161280 + t * (11 / 504 + t * (830251 / 7257600))), this.gtu[3] = i * (49561 / 161280 + t * (-179 / 168 + t * (6601661 / 7257600))), i = i * t, this.utg[4] = i * (-4583 / 161280 + t * (108847 / 3991680)), this.gtu[4] = i * (34729 / 80640 + t * (-3418889 / 1995840)), i = i * t, this.utg[5] = i * (-20648693 / 638668800), this.gtu[5] = i * (212378941 / 319334400);
1638  var s = $l(this.cbg, this.lat0);
1639  this.Zb = -this.Qn * (s + km(this.gtu, 2 * s));
1640}
1641function Gm(e) {
1642  var t = U(e.x - this.long0), i = e.y;
1643  i = $l(this.cbg, i);
1644  var s = Math.sin(i), n = Math.cos(i), r = Math.sin(t), o = Math.cos(t);
1645  i = Math.atan2(s, o * n), t = Math.atan2(r * n, ke(s, n * o)), t = Fm(Math.tan(t));
1646  var a = Ld(this.gtu, 2 * i, 2 * t);
1647  i = i + a[0], t = t + a[1];
1648  var l, h;
1649  return Math.abs(t) <= 2.623395162778 ? (l = this.a * (this.Qn * t) + this.x0, h = this.a * (this.Qn * i + this.Zb) + this.y0) : (l = 1 / 0, h = 1 / 0), e.x = l, e.y = h, e;
1650}
1651function zm(e) {
1652  var t = (e.x - this.x0) * (1 / this.a), i = (e.y - this.y0) * (1 / this.a);
1653  i = (i - this.Zb) / this.Qn, t = t / this.Qn;
1654  var s, n;
1655  if (Math.abs(t) <= 2.623395162778) {
1656    var r = Ld(this.utg, 2 * i, 2 * t);
1657    i = i + r[0], t = t + r[1], t = Math.atan(Ad(t));
1658    var o = Math.sin(i), a = Math.cos(i), l = Math.sin(t), h = Math.cos(t);
1659    i = Math.atan2(o * h, ke(l, h * a)), t = Math.atan2(l, h * a), s = U(t + this.long0), n = $l(this.cgb, i);
1660  } else
1661    s = 1 / 0, n = 1 / 0;
1662  return e.x = s, e.y = n, e;
1663}
1664var jm = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc", "Transverse_Mercator", "Transverse Mercator", "tmerc"];
1665const fo = {
1666  init: Nm,
1667  forward: Gm,
1668  inverse: zm,
1669  names: jm
1670};
1671function Wm(e, t) {
1672  if (e === void 0) {
1673    if (e = Math.floor((U(t) + Math.PI) * 30 / Math.PI) + 1, e < 0)
1674      return 0;
1675    if (e > 60)
1676      return 60;
1677  }
1678  return e;
1679}
1680var Bm = "etmerc";
1681function Um() {
1682  var e = Wm(this.zone, this.long0);
1683  if (e === void 0)
1684    throw new Error("unknown utm zone");
1685  this.lat0 = 0, this.long0 = (6 * Math.abs(e) - 183) * qt, this.x0 = 5e5, this.y0 = this.utmSouth ? 1e7 : 0, this.k0 = 0.9996, fo.init.apply(this), this.forward = fo.forward, this.inverse = fo.inverse;
1686}
1687var Xm = ["Universal Transverse Mercator System", "utm"];
1688const $m = {
1689  init: Um,
1690  names: Xm,
1691  dependsOn: Bm
1692};
1693function Yl(e, t) {
1694  return Math.pow((1 - e) / (1 + e), t);
1695}
1696var Ym = 20;
1697function Km() {
1698  var e = Math.sin(this.lat0), t = Math.cos(this.lat0);
1699  t *= t, this.rc = Math.sqrt(1 - this.es) / (1 - this.es * e * e), this.C = Math.sqrt(1 + this.es * t * t / (1 - this.es)), this.phic0 = Math.asin(e / this.C), this.ratexp = 0.5 * this.C * this.e, this.K = Math.tan(0.5 * this.phic0 + yt) / (Math.pow(Math.tan(0.5 * this.lat0 + yt), this.C) * Yl(this.e * e, this.ratexp));
1700}
1701function qm(e) {
1702  var t = e.x, i = e.y;
1703  return e.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * i + yt), this.C) * Yl(this.e * Math.sin(i), this.ratexp)) - A, e.x = this.C * t, e;
1704}
1705function Vm(e) {
1706  for (var t = 1e-14, i = e.x / this.C, s = e.y, n = Math.pow(Math.tan(0.5 * s + yt) / this.K, 1 / this.C), r = Ym; r > 0 && (s = 2 * Math.atan(n * Yl(this.e * Math.sin(e.y), -0.5 * this.e)) - A, !(Math.abs(s - e.y) < t)); --r)
1707    e.y = s;
1708  return r ? (e.x = i, e.y = s, e) : null;
1709}
1710var Hm = ["gauss"];
1711const Kl = {
1712  init: Km,
1713  forward: qm,
1714  inverse: Vm,
1715  names: Hm
1716};
1717function Zm() {
1718  Kl.init.apply(this), this.rc && (this.sinc0 = Math.sin(this.phic0), this.cosc0 = Math.cos(this.phic0), this.R2 = 2 * this.rc, this.title || (this.title = "Oblique Stereographic Alternative"));
1719}
1720function Jm(e) {
1721  var t, i, s, n;
1722  return e.x = U(e.x - this.long0), Kl.forward.apply(this, [e]), t = Math.sin(e.y), i = Math.cos(e.y), s = Math.cos(e.x), n = this.k0 * this.R2 / (1 + this.sinc0 * t + this.cosc0 * i * s), e.x = n * i * Math.sin(e.x), e.y = n * (this.cosc0 * t - this.sinc0 * i * s), e.x = this.a * e.x + this.x0, e.y = this.a * e.y + this.y0, e;
1723}
1724function Qm(e) {
1725  var t, i, s, n, r;
1726  if (e.x = (e.x - this.x0) / this.a, e.y = (e.y - this.y0) / this.a, e.x /= this.k0, e.y /= this.k0, r = Math.sqrt(e.x * e.x + e.y * e.y)) {
1727    var o = 2 * Math.atan2(r, this.R2);
1728    t = Math.sin(o), i = Math.cos(o), n = Math.asin(i * this.sinc0 + e.y * t * this.cosc0 / r), s = Math.atan2(e.x * t, r * this.cosc0 * i - e.y * this.sinc0 * t);
1729  } else
1730    n = this.phic0, s = 0;
1731  return e.x = s, e.y = n, Kl.inverse.apply(this, [e]), e.x = U(e.x + this.long0), e;
1732}
1733var t0 = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea", "Oblique Stereographic Alternative", "Double_Stereographic"];
1734const e0 = {
1735  init: Zm,
1736  forward: Jm,
1737  inverse: Qm,
1738  names: t0
1739};
1740function i0(e, t, i) {
1741  return t *= i, Math.tan(0.5 * (A + e)) * Math.pow((1 - t) / (1 + t), 0.5 * i);
1742}
1743function s0() {
1744  this.coslat0 = Math.cos(this.lat0), this.sinlat0 = Math.sin(this.lat0), this.sphere ? this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= G && (this.k0 = 0.5 * (1 + Er(this.lat0) * Math.sin(this.lat_ts))) : (Math.abs(this.coslat0) <= G && (this.lat0 > 0 ? this.con = 1 : this.con = -1), this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e)), this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= G && (this.k0 = 0.5 * this.cons * ti(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / ze(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts))), this.ms1 = ti(this.e, this.sinlat0, this.coslat0), this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - A, this.cosX0 = Math.cos(this.X0), this.sinX0 = Math.sin(this.X0));
1745}
1746function n0(e) {
1747  var t = e.x, i = e.y, s = Math.sin(i), n = Math.cos(i), r, o, a, l, h, c, u = U(t - this.long0);
1748  return Math.abs(Math.abs(t - this.long0) - Math.PI) <= G && Math.abs(i + this.lat0) <= G ? (e.x = NaN, e.y = NaN, e) : this.sphere ? (r = 2 * this.k0 / (1 + this.sinlat0 * s + this.coslat0 * n * Math.cos(u)), e.x = this.a * r * n * Math.sin(u) + this.x0, e.y = this.a * r * (this.coslat0 * s - this.sinlat0 * n * Math.cos(u)) + this.y0, e) : (o = 2 * Math.atan(this.ssfn_(i, s, this.e)) - A, l = Math.cos(o), a = Math.sin(o), Math.abs(this.coslat0) <= G ? (h = ze(this.e, i * this.con, this.con * s), c = 2 * this.a * this.k0 * h / this.cons, e.x = this.x0 + c * Math.sin(t - this.long0), e.y = this.y0 - this.con * c * Math.cos(t - this.long0), e) : (Math.abs(this.sinlat0) < G ? (r = 2 * this.a * this.k0 / (1 + l * Math.cos(u)), e.y = r * a) : (r = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * a + this.cosX0 * l * Math.cos(u))), e.y = r * (this.cosX0 * a - this.sinX0 * l * Math.cos(u)) + this.y0), e.x = r * l * Math.sin(u) + this.x0, e));
1749}
1750function r0(e) {
1751  e.x -= this.x0, e.y -= this.y0;
1752  var t, i, s, n, r, o = Math.sqrt(e.x * e.x + e.y * e.y);
1753  if (this.sphere) {
1754    var a = 2 * Math.atan(o / (2 * this.a * this.k0));
1755    return t = this.long0, i = this.lat0, o <= G ? (e.x = t, e.y = i, e) : (i = Math.asin(Math.cos(a) * this.sinlat0 + e.y * Math.sin(a) * this.coslat0 / o), Math.abs(this.coslat0) < G ? this.lat0 > 0 ? t = U(this.long0 + Math.atan2(e.x, -1 * e.y)) : t = U(this.long0 + Math.atan2(e.x, e.y)) : t = U(this.long0 + Math.atan2(e.x * Math.sin(a), o * this.coslat0 * Math.cos(a) - e.y * this.sinlat0 * Math.sin(a))), e.x = t, e.y = i, e);
1756  } else if (Math.abs(this.coslat0) <= G) {
1757    if (o <= G)
1758      return i = this.lat0, t = this.long0, e.x = t, e.y = i, e;
1759    e.x *= this.con, e.y *= this.con, s = o * this.cons / (2 * this.a * this.k0), i = this.con * ir(this.e, s), t = this.con * U(this.con * this.long0 + Math.atan2(e.x, -1 * e.y));
1760  } else
1761    n = 2 * Math.atan(o * this.cosX0 / (2 * this.a * this.k0 * this.ms1)), t = this.long0, o <= G ? r = this.X0 : (r = Math.asin(Math.cos(n) * this.sinX0 + e.y * Math.sin(n) * this.cosX0 / o), t = U(this.long0 + Math.atan2(e.x * Math.sin(n), o * this.cosX0 * Math.cos(n) - e.y * this.sinX0 * Math.sin(n)))), i = -1 * ir(this.e, Math.tan(0.5 * (A + r)));
1762  return e.x = t, e.y = i, e;
1763}
1764var o0 = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
1765const a0 = {
1766  init: s0,
1767  forward: n0,
1768  inverse: r0,
1769  names: o0,
1770  ssfn_: i0
1771};
1772function l0() {
1773  var e = this.lat0;
1774  this.lambda0 = this.long0;
1775  var t = Math.sin(e), i = this.a, s = this.rf, n = 1 / s, r = 2 * n - Math.pow(n, 2), o = this.e = Math.sqrt(r);
1776  this.R = this.k0 * i * Math.sqrt(1 - r) / (1 - r * Math.pow(t, 2)), this.alpha = Math.sqrt(1 + r / (1 - r) * Math.pow(Math.cos(e), 4)), this.b0 = Math.asin(t / this.alpha);
1777  var a = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2)), l = Math.log(Math.tan(Math.PI / 4 + e / 2)), h = Math.log((1 + o * t) / (1 - o * t));
1778  this.K = a - this.alpha * l + this.alpha * o / 2 * h;
1779}
1780function h0(e) {
1781  var t = Math.log(Math.tan(Math.PI / 4 - e.y / 2)), i = this.e / 2 * Math.log((1 + this.e * Math.sin(e.y)) / (1 - this.e * Math.sin(e.y))), s = -this.alpha * (t + i) + this.K, n = 2 * (Math.atan(Math.exp(s)) - Math.PI / 4), r = this.alpha * (e.x - this.lambda0), o = Math.atan(Math.sin(r) / (Math.sin(this.b0) * Math.tan(n) + Math.cos(this.b0) * Math.cos(r))), a = Math.asin(Math.cos(this.b0) * Math.sin(n) - Math.sin(this.b0) * Math.cos(n) * Math.cos(r));
1782  return e.y = this.R / 2 * Math.log((1 + Math.sin(a)) / (1 - Math.sin(a))) + this.y0, e.x = this.R * o + this.x0, e;
1783}
1784function c0(e) {
1785  for (var t = e.x - this.x0, i = e.y - this.y0, s = t / this.R, n = 2 * (Math.atan(Math.exp(i / this.R)) - Math.PI / 4), r = Math.asin(Math.cos(this.b0) * Math.sin(n) + Math.sin(this.b0) * Math.cos(n) * Math.cos(s)), o = Math.atan(Math.sin(s) / (Math.cos(this.b0) * Math.cos(s) - Math.sin(this.b0) * Math.tan(n))), a = this.lambda0 + o / this.alpha, l = 0, h = r, c = -1e3, u = 0; Math.abs(h - c) > 1e-7; ) {
1786    if (++u > 20)
1787      return;
1788    l = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + r / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(h)) / 2)), c = h, h = 2 * Math.atan(Math.exp(l)) - Math.PI / 2;
1789  }
1790  return e.x = a, e.y = h, e;
1791}
1792var u0 = ["somerc"];
1793const d0 = {
1794  init: l0,
1795  forward: h0,
1796  inverse: c0,
1797  names: u0
1798};
1799var Bs = 1e-7;
1800function f0(e) {
1801  var t = ["Hotine_Oblique_Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin"], i = typeof e.PROJECTION == "object" ? Object.keys(e.PROJECTION)[0] : e.PROJECTION;
1802  return "no_uoff" in e || "no_off" in e || t.indexOf(i) !== -1;
1803}
1804function g0() {
1805  var e, t, i, s, n, r, o, a, l, h, c = 0, u, d = 0, f = 0, g = 0, _ = 0, m = 0, p = 0;
1806  this.no_off = f0(this), this.no_rot = "no_rot" in this;
1807  var y = !1;
1808  "alpha" in this && (y = !0);
1809  var v = !1;
1810  if ("rectified_grid_angle" in this && (v = !0), y && (p = this.alpha), v && (c = this.rectified_grid_angle * qt), y || v)
1811    d = this.longc;
1812  else if (f = this.long1, _ = this.lat1, g = this.long2, m = this.lat2, Math.abs(_ - m) <= Bs || (e = Math.abs(_)) <= Bs || Math.abs(e - A) <= Bs || Math.abs(Math.abs(this.lat0) - A) <= Bs || Math.abs(Math.abs(m) - A) <= Bs)
1813    throw new Error();
1814  var E = 1 - this.es;
1815  t = Math.sqrt(E), Math.abs(this.lat0) > G ? (a = Math.sin(this.lat0), i = Math.cos(this.lat0), e = 1 - this.es * a * a, this.B = i * i, this.B = Math.sqrt(1 + this.es * this.B * this.B / E), this.A = this.B * this.k0 * t / e, s = this.B * t / (i * Math.sqrt(e)), n = s * s - 1, n <= 0 ? n = 0 : (n = Math.sqrt(n), this.lat0 < 0 && (n = -n)), this.E = n += s, this.E *= Math.pow(ze(this.e, this.lat0, a), this.B)) : (this.B = 1 / t, this.A = this.k0, this.E = s = n = 1), y || v ? (y ? (u = Math.asin(Math.sin(p) / s), v || (c = p)) : (u = c, p = Math.asin(s * Math.sin(u))), this.lam0 = d - Math.asin(0.5 * (n - 1 / n) * Math.tan(u)) / this.B) : (r = Math.pow(ze(this.e, _, Math.sin(_)), this.B), o = Math.pow(ze(this.e, m, Math.sin(m)), this.B), n = this.E / r, l = (o - r) / (o + r), h = this.E * this.E, h = (h - o * r) / (h + o * r), e = f - g, e < -Math.pi ? g -= tr : e > Math.pi && (g += tr), this.lam0 = U(0.5 * (f + g) - Math.atan(h * Math.tan(0.5 * this.B * (f - g)) / l) / this.B), u = Math.atan(2 * Math.sin(this.B * U(f - this.lam0)) / (n - 1 / n)), c = p = Math.asin(s * Math.sin(u))), this.singam = Math.sin(u), this.cosgam = Math.cos(u), this.sinrot = Math.sin(c), this.cosrot = Math.cos(c), this.rB = 1 / this.B, this.ArB = this.A * this.rB, this.BrA = 1 / this.ArB, this.A * this.B, this.no_off ? this.u_0 = 0 : (this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(s * s - 1) / Math.cos(p))), this.lat0 < 0 && (this.u_0 = -this.u_0)), n = 0.5 * u, this.v_pole_n = this.ArB * Math.log(Math.tan(yt - n)), this.v_pole_s = this.ArB * Math.log(Math.tan(yt + n));
1816}
1817function _0(e) {
1818  var t = {}, i, s, n, r, o, a, l, h;
1819  if (e.x = e.x - this.lam0, Math.abs(Math.abs(e.y) - A) > G) {
1820    if (o = this.E / Math.pow(ze(this.e, e.y, Math.sin(e.y)), this.B), a = 1 / o, i = 0.5 * (o - a), s = 0.5 * (o + a), r = Math.sin(this.B * e.x), n = (i * this.singam - r * this.cosgam) / s, Math.abs(Math.abs(n) - 1) < G)
1821      throw new Error();
1822    h = 0.5 * this.ArB * Math.log((1 - n) / (1 + n)), a = Math.cos(this.B * e.x), Math.abs(a) < Bs ? l = this.A * e.x : l = this.ArB * Math.atan2(i * this.cosgam + r * this.singam, a);
1823  } else
1824    h = e.y > 0 ? this.v_pole_n : this.v_pole_s, l = this.ArB * e.y;
1825  return this.no_rot ? (t.x = l, t.y = h) : (l -= this.u_0, t.x = h * this.cosrot + l * this.sinrot, t.y = l * this.cosrot - h * this.sinrot), t.x = this.a * t.x + this.x0, t.y = this.a * t.y + this.y0, t;
1826}
1827function m0(e) {
1828  var t, i, s, n, r, o, a, l = {};
1829  if (e.x = (e.x - this.x0) * (1 / this.a), e.y = (e.y - this.y0) * (1 / this.a), this.no_rot ? (i = e.y, t = e.x) : (i = e.x * this.cosrot - e.y * this.sinrot, t = e.y * this.cosrot + e.x * this.sinrot + this.u_0), s = Math.exp(-this.BrA * i), n = 0.5 * (s - 1 / s), r = 0.5 * (s + 1 / s), o = Math.sin(this.BrA * t), a = (o * this.cosgam + n * this.singam) / r, Math.abs(Math.abs(a) - 1) < G)
1830    l.x = 0, l.y = a < 0 ? -A : A;
1831  else {
1832    if (l.y = this.E / Math.sqrt((1 + a) / (1 - a)), l.y = ir(this.e, Math.pow(l.y, 1 / this.B)), l.y === 1 / 0)
1833      throw new Error();
1834    l.x = -this.rB * Math.atan2(n * this.cosgam - o * this.singam, Math.cos(this.BrA * t));
1835  }
1836  return l.x += this.lam0, l;
1837}
1838var p0 = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Two_Point_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "Oblique_Mercator", "omerc"];
1839const y0 = {
1840  init: g0,
1841  forward: _0,
1842  inverse: m0,
1843  names: p0
1844};
1845function x0() {
1846  if (this.lat2 || (this.lat2 = this.lat1), this.k0 || (this.k0 = 1), this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, !(Math.abs(this.lat1 + this.lat2) < G)) {
1847    var e = this.b / this.a;
1848    this.e = Math.sqrt(1 - e * e);
1849    var t = Math.sin(this.lat1), i = Math.cos(this.lat1), s = ti(this.e, t, i), n = ze(this.e, this.lat1, t), r = Math.sin(this.lat2), o = Math.cos(this.lat2), a = ti(this.e, r, o), l = ze(this.e, this.lat2, r), h = ze(this.e, this.lat0, Math.sin(this.lat0));
1850    Math.abs(this.lat1 - this.lat2) > G ? this.ns = Math.log(s / a) / Math.log(n / l) : this.ns = t, isNaN(this.ns) && (this.ns = t), this.f0 = s / (this.ns * Math.pow(n, this.ns)), this.rh = this.a * this.f0 * Math.pow(h, this.ns), this.title || (this.title = "Lambert Conformal Conic");
1851  }
1852}
1853function v0(e) {
1854  var t = e.x, i = e.y;
1855  Math.abs(2 * Math.abs(i) - Math.PI) <= G && (i = Er(i) * (A - 2 * G));
1856  var s = Math.abs(Math.abs(i) - A), n, r;
1857  if (s > G)
1858    n = ze(this.e, i, Math.sin(i)), r = this.a * this.f0 * Math.pow(n, this.ns);
1859  else {
1860    if (s = i * this.ns, s <= 0)
1861      return null;
1862    r = 0;
1863  }
1864  var o = this.ns * U(t - this.long0);
1865  return e.x = this.k0 * (r * Math.sin(o)) + this.x0, e.y = this.k0 * (this.rh - r * Math.cos(o)) + this.y0, e;
1866}
1867function E0(e) {
1868  var t, i, s, n, r, o = (e.x - this.x0) / this.k0, a = this.rh - (e.y - this.y0) / this.k0;
1869  this.ns > 0 ? (t = Math.sqrt(o * o + a * a), i = 1) : (t = -Math.sqrt(o * o + a * a), i = -1);
1870  var l = 0;
1871  if (t !== 0 && (l = Math.atan2(i * o, i * a)), t !== 0 || this.ns > 0) {
1872    if (i = 1 / this.ns, s = Math.pow(t / (this.a * this.f0), i), n = ir(this.e, s), n === -9999)
1873      return null;
1874  } else
1875    n = -A;
1876  return r = U(l / this.ns + this.long0), e.x = r, e.y = n, e;
1877}
1878var M0 = [
1879  "Lambert Tangential Conformal Conic Projection",
1880  "Lambert_Conformal_Conic",
1881  "Lambert_Conformal_Conic_1SP",
1882  "Lambert_Conformal_Conic_2SP",
1883  "lcc",
1884  "Lambert Conic Conformal (1SP)",
1885  "Lambert Conic Conformal (2SP)"
1886];
1887const C0 = {
1888  init: x0,
1889  forward: v0,
1890  inverse: E0,
1891  names: M0
1892};
1893function b0() {
1894  this.a = 6377397155e-3, this.es = 0.006674372230614, this.e = Math.sqrt(this.es), this.lat0 || (this.lat0 = 0.863937979737193), this.long0 || (this.long0 = 0.7417649320975901 - 0.308341501185665), this.k0 || (this.k0 = 0.9999), this.s45 = 0.785398163397448, this.s90 = 2 * this.s45, this.fi0 = this.lat0, this.e2 = this.es, this.e = Math.sqrt(this.e2), this.alfa = Math.sqrt(1 + this.e2 * Math.pow(Math.cos(this.fi0), 4) / (1 - this.e2)), this.uq = 1.04216856380474, this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa), this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2), this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g, this.k1 = this.k0, this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2)), this.s0 = 1.37008346281555, this.n = Math.sin(this.s0), this.ro0 = this.k1 * this.n0 / Math.tan(this.s0), this.ad = this.s90 - this.uq;
1895}
1896function w0(e) {
1897  var t, i, s, n, r, o, a, l = e.x, h = e.y, c = U(l - this.long0);
1898  return t = Math.pow((1 + this.e * Math.sin(h)) / (1 - this.e * Math.sin(h)), this.alfa * this.e / 2), i = 2 * (Math.atan(this.k * Math.pow(Math.tan(h / 2 + this.s45), this.alfa) / t) - this.s45), s = -c * this.alfa, n = Math.asin(Math.cos(this.ad) * Math.sin(i) + Math.sin(this.ad) * Math.cos(i) * Math.cos(s)), r = Math.asin(Math.cos(i) * Math.sin(s) / Math.cos(n)), o = this.n * r, a = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(n / 2 + this.s45), this.n), e.y = a * Math.cos(o) / 1, e.x = a * Math.sin(o) / 1, this.czech || (e.y *= -1, e.x *= -1), e;
1899}
1900function S0(e) {
1901  var t, i, s, n, r, o, a, l, h = e.x;
1902  e.x = e.y, e.y = h, this.czech || (e.y *= -1, e.x *= -1), o = Math.sqrt(e.x * e.x + e.y * e.y), r = Math.atan2(e.y, e.x), n = r / Math.sin(this.s0), s = 2 * (Math.atan(Math.pow(this.ro0 / o, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45), t = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(n)), i = Math.asin(Math.cos(s) * Math.sin(n) / Math.cos(t)), e.x = this.long0 - i / this.alfa, a = t, l = 0;
1903  var c = 0;
1904  do
1905    e.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(t / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(a)) / (1 - this.e * Math.sin(a)), this.e / 2)) - this.s45), Math.abs(a - e.y) < 1e-10 && (l = 1), a = e.y, c += 1;
1906  while (l === 0 && c < 15);
1907  return c >= 15 ? null : e;
1908}
1909var T0 = ["Krovak", "krovak"];
1910const R0 = {
1911  init: b0,
1912  forward: w0,
1913  inverse: S0,
1914  names: T0
1915};
1916function ue(e, t, i, s, n) {
1917  return e * n - t * Math.sin(2 * n) + i * Math.sin(4 * n) - s * Math.sin(6 * n);
1918}
1919function Mr(e) {
1920  return 1 - 0.25 * e * (1 + e / 16 * (3 + 1.25 * e));
1921}
1922function Cr(e) {
1923  return 0.375 * e * (1 + 0.25 * e * (1 + 0.46875 * e));
1924}
1925function br(e) {
1926  return 0.05859375 * e * e * (1 + 0.75 * e);
1927}
1928function wr(e) {
1929  return e * e * e * (35 / 3072);
1930}
1931function gn(e, t, i) {
1932  var s = t * i;
1933  return e / Math.sqrt(1 - s * s);
1934}
1935function Sn(e) {
1936  return Math.abs(e) < A ? e : e - Er(e) * Math.PI;
1937}
1938function Mo(e, t, i, s, n) {
1939  var r, o;
1940  r = e / t;
1941  for (var a = 0; a < 15; a++)
1942    if (o = (e - (t * r - i * Math.sin(2 * r) + s * Math.sin(4 * r) - n * Math.sin(6 * r))) / (t - 2 * i * Math.cos(2 * r) + 4 * s * Math.cos(4 * r) - 6 * n * Math.cos(6 * r)), r += o, Math.abs(o) <= 1e-10)
1943      return r;
1944  return NaN;
1945}
1946function I0() {
1947  this.sphere || (this.e0 = Mr(this.es), this.e1 = Cr(this.es), this.e2 = br(this.es), this.e3 = wr(this.es), this.ml0 = this.a * ue(this.e0, this.e1, this.e2, this.e3, this.lat0));
1948}
1949function P0(e) {
1950  var t, i, s = e.x, n = e.y;
1951  if (s = U(s - this.long0), this.sphere)
1952    t = this.a * Math.asin(Math.cos(n) * Math.sin(s)), i = this.a * (Math.atan2(Math.tan(n), Math.cos(s)) - this.lat0);
1953  else {
1954    var r = Math.sin(n), o = Math.cos(n), a = gn(this.a, this.e, r), l = Math.tan(n) * Math.tan(n), h = s * Math.cos(n), c = h * h, u = this.es * o * o / (1 - this.es), d = this.a * ue(this.e0, this.e1, this.e2, this.e3, n);
1955    t = a * h * (1 - c * l * (1 / 6 - (8 - l + 8 * u) * c / 120)), i = d - this.ml0 + a * r / o * c * (0.5 + (5 - l + 6 * u) * c / 24);
1956  }
1957  return e.x = t + this.x0, e.y = i + this.y0, e;
1958}
1959function A0(e) {
1960  e.x -= this.x0, e.y -= this.y0;
1961  var t = e.x / this.a, i = e.y / this.a, s, n;
1962  if (this.sphere) {
1963    var r = i + this.lat0;
1964    s = Math.asin(Math.sin(r) * Math.cos(t)), n = Math.atan2(Math.tan(t), Math.cos(r));
1965  } else {
1966    var o = this.ml0 / this.a + i, a = Mo(o, this.e0, this.e1, this.e2, this.e3);
1967    if (Math.abs(Math.abs(a) - A) <= G)
1968      return e.x = this.long0, e.y = A, i < 0 && (e.y *= -1), e;
1969    var l = gn(this.a, this.e, Math.sin(a)), h = l * l * l / this.a / this.a * (1 - this.es), c = Math.pow(Math.tan(a), 2), u = t * this.a / l, d = u * u;
1970    s = a - l * Math.tan(a) / h * u * u * (0.5 - (1 + 3 * c) * u * u / 24), n = u * (1 - d * (c / 3 + (1 + 3 * c) * c * d / 15)) / Math.cos(a);
1971  }
1972  return e.x = U(n + this.long0), e.y = Sn(s), e;
1973}
1974var L0 = ["Cassini", "Cassini_Soldner", "cass"];
1975const O0 = {
1976  init: I0,
1977  forward: P0,
1978  inverse: A0,
1979  names: L0
1980};
1981function Xi(e, t) {
1982  var i;
1983  return e > 1e-7 ? (i = e * t, (1 - e * e) * (t / (1 - i * i) - 0.5 / e * Math.log((1 - i) / (1 + i)))) : 2 * t;
1984}
1985var F0 = 1, k0 = 2, D0 = 3, N0 = 4;
1986function G0() {
1987  var e = Math.abs(this.lat0);
1988  if (Math.abs(e - A) < G ? this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE : Math.abs(e) < G ? this.mode = this.EQUIT : this.mode = this.OBLIQ, this.es > 0) {
1989    var t;
1990    switch (this.qp = Xi(this.e, 1), this.mmf = 0.5 / (1 - this.es), this.apa = K0(this.es), this.mode) {
1991      case this.N_POLE:
1992        this.dd = 1;
1993        break;
1994      case this.S_POLE:
1995        this.dd = 1;
1996        break;
1997      case this.EQUIT:
1998        this.rq = Math.sqrt(0.5 * this.qp), this.dd = 1 / this.rq, this.xmf = 1, this.ymf = 0.5 * this.qp;
1999        break;
2000      case this.OBLIQ:
2001        this.rq = Math.sqrt(0.5 * this.qp), t = Math.sin(this.lat0), this.sinb1 = Xi(this.e, t) / this.qp, this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1), this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * t * t) * this.rq * this.cosb1), this.ymf = (this.xmf = this.rq) / this.dd, this.xmf *= this.dd;
2002        break;
2003    }
2004  } else
2005    this.mode === this.OBLIQ && (this.sinph0 = Math.sin(this.lat0), this.cosph0 = Math.cos(this.lat0));
2006}
2007function z0(e) {
2008  var t, i, s, n, r, o, a, l, h, c, u = e.x, d = e.y;
2009  if (u = U(u - this.long0), this.sphere) {
2010    if (r = Math.sin(d), c = Math.cos(d), s = Math.cos(u), this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2011      if (i = this.mode === this.EQUIT ? 1 + c * s : 1 + this.sinph0 * r + this.cosph0 * c * s, i <= G)
2012        return null;
2013      i = Math.sqrt(2 / i), t = i * c * Math.sin(u), i *= this.mode === this.EQUIT ? r : this.cosph0 * r - this.sinph0 * c * s;
2014    } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2015      if (this.mode === this.N_POLE && (s = -s), Math.abs(d + this.lat0) < G)
2016        return null;
2017      i = yt - d * 0.5, i = 2 * (this.mode === this.S_POLE ? Math.cos(i) : Math.sin(i)), t = i * Math.sin(u), i *= s;
2018    }
2019  } else {
2020    switch (a = 0, l = 0, h = 0, s = Math.cos(u), n = Math.sin(u), r = Math.sin(d), o = Xi(this.e, r), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (a = o / this.qp, l = Math.sqrt(1 - a * a)), this.mode) {
2021      case this.OBLIQ:
2022        h = 1 + this.sinb1 * a + this.cosb1 * l * s;
2023        break;
2024      case this.EQUIT:
2025        h = 1 + l * s;
2026        break;
2027      case this.N_POLE:
2028        h = A + d, o = this.qp - o;
2029        break;
2030      case this.S_POLE:
2031        h = d - A, o = this.qp + o;
2032        break;
2033    }
2034    if (Math.abs(h) < G)
2035      return null;
2036    switch (this.mode) {
2037      case this.OBLIQ:
2038      case this.EQUIT:
2039        h = Math.sqrt(2 / h), this.mode === this.OBLIQ ? i = this.ymf * h * (this.cosb1 * a - this.sinb1 * l * s) : i = (h = Math.sqrt(2 / (1 + l * s))) * a * this.ymf, t = this.xmf * h * l * n;
2040        break;
2041      case this.N_POLE:
2042      case this.S_POLE:
2043        o >= 0 ? (t = (h = Math.sqrt(o)) * n, i = s * (this.mode === this.S_POLE ? h : -h)) : t = i = 0;
2044        break;
2045    }
2046  }
2047  return e.x = this.a * t + this.x0, e.y = this.a * i + this.y0, e;
2048}
2049function j0(e) {
2050  e.x -= this.x0, e.y -= this.y0;
2051  var t = e.x / this.a, i = e.y / this.a, s, n, r, o, a, l, h;
2052  if (this.sphere) {
2053    var c = 0, u, d = 0;
2054    if (u = Math.sqrt(t * t + i * i), n = u * 0.5, n > 1)
2055      return null;
2056    switch (n = 2 * Math.asin(n), (this.mode === this.OBLIQ || this.mode === this.EQUIT) && (d = Math.sin(n), c = Math.cos(n)), this.mode) {
2057      case this.EQUIT:
2058        n = Math.abs(u) <= G ? 0 : Math.asin(i * d / u), t *= d, i = c * u;
2059        break;
2060      case this.OBLIQ:
2061        n = Math.abs(u) <= G ? this.lat0 : Math.asin(c * this.sinph0 + i * d * this.cosph0 / u), t *= d * this.cosph0, i = (c - Math.sin(n) * this.sinph0) * u;
2062        break;
2063      case this.N_POLE:
2064        i = -i, n = A - n;
2065        break;
2066      case this.S_POLE:
2067        n -= A;
2068        break;
2069    }
2070    s = i === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : Math.atan2(t, i);
2071  } else {
2072    if (h = 0, this.mode === this.OBLIQ || this.mode === this.EQUIT) {
2073      if (t /= this.dd, i *= this.dd, l = Math.sqrt(t * t + i * i), l < G)
2074        return e.x = this.long0, e.y = this.lat0, e;
2075      o = 2 * Math.asin(0.5 * l / this.rq), r = Math.cos(o), t *= o = Math.sin(o), this.mode === this.OBLIQ ? (h = r * this.sinb1 + i * o * this.cosb1 / l, a = this.qp * h, i = l * this.cosb1 * r - i * this.sinb1 * o) : (h = i * o / l, a = this.qp * h, i = l * r);
2076    } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
2077      if (this.mode === this.N_POLE && (i = -i), a = t * t + i * i, !a)
2078        return e.x = this.long0, e.y = this.lat0, e;
2079      h = 1 - a / this.qp, this.mode === this.S_POLE && (h = -h);
2080    }
2081    s = Math.atan2(t, i), n = q0(Math.asin(h), this.apa);
2082  }
2083  return e.x = U(this.long0 + s), e.y = n, e;
2084}
2085var W0 = 0.3333333333333333, B0 = 0.17222222222222222, U0 = 0.10257936507936508, X0 = 0.06388888888888888, $0 = 0.0664021164021164, Y0 = 0.016415012942191543;
2086function K0(e) {
2087  var t, i = [];
2088  return i[0] = e * W0, t = e * e, i[0] += t * B0, i[1] = t * X0, t *= e, i[0] += t * U0, i[1] += t * $0, i[2] = t * Y0, i;
2089}
2090function q0(e, t) {
2091  var i = e + e;
2092  return e + t[0] * Math.sin(i) + t[1] * Math.sin(i + i) + t[2] * Math.sin(i + i + i);
2093}
2094var V0 = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
2095const H0 = {
2096  init: G0,
2097  forward: z0,
2098  inverse: j0,
2099  names: V0,
2100  S_POLE: F0,
2101  N_POLE: k0,
2102  EQUIT: D0,
2103  OBLIQ: N0
2104};
2105function Zi(e) {
2106  return Math.abs(e) > 1 && (e = e > 1 ? 1 : -1), Math.asin(e);
2107}
2108function Z0() {
2109  Math.abs(this.lat1 + this.lat2) < G || (this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e3 = Math.sqrt(this.es), this.sin_po = Math.sin(this.lat1), this.cos_po = Math.cos(this.lat1), this.t1 = this.sin_po, this.con = this.sin_po, this.ms1 = ti(this.e3, this.sin_po, this.cos_po), this.qs1 = Xi(this.e3, this.sin_po), this.sin_po = Math.sin(this.lat2), this.cos_po = Math.cos(this.lat2), this.t2 = this.sin_po, this.ms2 = ti(this.e3, this.sin_po, this.cos_po), this.qs2 = Xi(this.e3, this.sin_po), this.sin_po = Math.sin(this.lat0), this.cos_po = Math.cos(this.lat0), this.t3 = this.sin_po, this.qs0 = Xi(this.e3, this.sin_po), Math.abs(this.lat1 - this.lat2) > G ? this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1) : this.ns0 = this.con, this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1, this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0);
2110}
2111function J0(e) {
2112  var t = e.x, i = e.y;
2113  this.sin_phi = Math.sin(i), this.cos_phi = Math.cos(i);
2114  var s = Xi(this.e3, this.sin_phi), n = this.a * Math.sqrt(this.c - this.ns0 * s) / this.ns0, r = this.ns0 * U(t - this.long0), o = n * Math.sin(r) + this.x0, a = this.rh - n * Math.cos(r) + this.y0;
2115  return e.x = o, e.y = a, e;
2116}
2117function Q0(e) {
2118  var t, i, s, n, r, o;
2119  return e.x -= this.x0, e.y = this.rh - e.y + this.y0, this.ns0 >= 0 ? (t = Math.sqrt(e.x * e.x + e.y * e.y), s = 1) : (t = -Math.sqrt(e.x * e.x + e.y * e.y), s = -1), n = 0, t !== 0 && (n = Math.atan2(s * e.x, s * e.y)), s = t * this.ns0 / this.a, this.sphere ? o = Math.asin((this.c - s * s) / (2 * this.ns0)) : (i = (this.c - s * s) / this.ns0, o = this.phi1z(this.e3, i)), r = U(n / this.ns0 + this.long0), e.x = r, e.y = o, e;
2120}
2121function tp(e, t) {
2122  var i, s, n, r, o, a = Zi(0.5 * t);
2123  if (e < G)
2124    return a;
2125  for (var l = e * e, h = 1; h <= 25; h++)
2126    if (i = Math.sin(a), s = Math.cos(a), n = e * i, r = 1 - n * n, o = 0.5 * r * r / s * (t / (1 - l) - i / r + 0.5 / e * Math.log((1 - n) / (1 + n))), a = a + o, Math.abs(o) <= 1e-7)
2127      return a;
2128  return null;
2129}
2130var ep = ["Albers_Conic_Equal_Area", "Albers", "aea"];
2131const ip = {
2132  init: Z0,
2133  forward: J0,
2134  inverse: Q0,
2135  names: ep,
2136  phi1z: tp
2137};
2138function sp() {
2139  this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0), this.infinity_dist = 1e3 * this.a, this.rc = 1;
2140}
2141function np(e) {
2142  var t, i, s, n, r, o, a, l, h = e.x, c = e.y;
2143  return s = U(h - this.long0), t = Math.sin(c), i = Math.cos(c), n = Math.cos(s), o = this.sin_p14 * t + this.cos_p14 * i * n, r = 1, o > 0 || Math.abs(o) <= G ? (a = this.x0 + this.a * r * i * Math.sin(s) / o, l = this.y0 + this.a * r * (this.cos_p14 * t - this.sin_p14 * i * n) / o) : (a = this.x0 + this.infinity_dist * i * Math.sin(s), l = this.y0 + this.infinity_dist * (this.cos_p14 * t - this.sin_p14 * i * n)), e.x = a, e.y = l, e;
2144}
2145function rp(e) {
2146  var t, i, s, n, r, o;
2147  return e.x = (e.x - this.x0) / this.a, e.y = (e.y - this.y0) / this.a, e.x /= this.k0, e.y /= this.k0, (t = Math.sqrt(e.x * e.x + e.y * e.y)) ? (n = Math.atan2(t, this.rc), i = Math.sin(n), s = Math.cos(n), o = Zi(s * this.sin_p14 + e.y * i * this.cos_p14 / t), r = Math.atan2(e.x * i, t * this.cos_p14 * s - e.y * this.sin_p14 * i), r = U(this.long0 + r)) : (o = this.phic0, r = 0), e.x = r, e.y = o, e;
2148}
2149var op = ["gnom"];
2150const ap = {
2151  init: sp,
2152  forward: np,
2153  inverse: rp,
2154  names: op
2155};
2156function lp(e, t) {
2157  var i = 1 - (1 - e * e) / (2 * e) * Math.log((1 - e) / (1 + e));
2158  if (Math.abs(Math.abs(t) - i) < 1e-6)
2159    return t < 0 ? -1 * A : A;
2160  for (var s = Math.asin(0.5 * t), n, r, o, a, l = 0; l < 30; l++)
2161    if (r = Math.sin(s), o = Math.cos(s), a = e * r, n = Math.pow(1 - a * a, 2) / (2 * o) * (t / (1 - e * e) - r / (1 - a * a) + 0.5 / e * Math.log((1 - a) / (1 + a))), s += n, Math.abs(n) <= 1e-10)
2162      return s;
2163  return NaN;
2164}
2165function hp() {
2166  this.sphere || (this.k0 = ti(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)));
2167}
2168function cp(e) {
2169  var t = e.x, i = e.y, s, n, r = U(t - this.long0);
2170  if (this.sphere)
2171    s = this.x0 + this.a * r * Math.cos(this.lat_ts), n = this.y0 + this.a * Math.sin(i) / Math.cos(this.lat_ts);
2172  else {
2173    var o = Xi(this.e, Math.sin(i));
2174    s = this.x0 + this.a * this.k0 * r, n = this.y0 + this.a * o * 0.5 / this.k0;
2175  }
2176  return e.x = s, e.y = n, e;
2177}
2178function up(e) {
2179  e.x -= this.x0, e.y -= this.y0;
2180  var t, i;
2181  return this.sphere ? (t = U(this.long0 + e.x / this.a / Math.cos(this.lat_ts)), i = Math.asin(e.y / this.a * Math.cos(this.lat_ts))) : (i = lp(this.e, 2 * e.y * this.k0 / this.a), t = U(this.long0 + e.x / (this.a * this.k0))), e.x = t, e.y = i, e;
2182}
2183var dp = ["cea"];
2184const fp = {
2185  init: hp,
2186  forward: cp,
2187  inverse: up,
2188  names: dp
2189};
2190function gp() {
2191  this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Equidistant Cylindrical (Plate Carre)", this.rc = Math.cos(this.lat_ts);
2192}
2193function _p(e) {
2194  var t = e.x, i = e.y, s = U(t - this.long0), n = Sn(i - this.lat0);
2195  return e.x = this.x0 + this.a * s * this.rc, e.y = this.y0 + this.a * n, e;
2196}
2197function mp(e) {
2198  var t = e.x, i = e.y;
2199  return e.x = U(this.long0 + (t - this.x0) / (this.a * this.rc)), e.y = Sn(this.lat0 + (i - this.y0) / this.a), e;
2200}
2201var pp = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
2202const yp = {
2203  init: gp,
2204  forward: _p,
2205  inverse: mp,
2206  names: pp
2207};
2208var Pc = 20;
2209function xp() {
2210  this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = Mr(this.es), this.e1 = Cr(this.es), this.e2 = br(this.es), this.e3 = wr(this.es), this.ml0 = this.a * ue(this.e0, this.e1, this.e2, this.e3, this.lat0);
2211}
2212function vp(e) {
2213  var t = e.x, i = e.y, s, n, r, o = U(t - this.long0);
2214  if (r = o * Math.sin(i), this.sphere)
2215    Math.abs(i) <= G ? (s = this.a * o, n = -1 * this.a * this.lat0) : (s = this.a * Math.sin(r) / Math.tan(i), n = this.a * (Sn(i - this.lat0) + (1 - Math.cos(r)) / Math.tan(i)));
2216  else if (Math.abs(i) <= G)
2217    s = this.a * o, n = -1 * this.ml0;
2218  else {
2219    var a = gn(this.a, this.e, Math.sin(i)) / Math.tan(i);
2220    s = a * Math.sin(r), n = this.a * ue(this.e0, this.e1, this.e2, this.e3, i) - this.ml0 + a * (1 - Math.cos(r));
2221  }
2222  return e.x = s + this.x0, e.y = n + this.y0, e;
2223}
2224function Ep(e) {
2225  var t, i, s, n, r, o, a, l, h;
2226  if (s = e.x - this.x0, n = e.y - this.y0, this.sphere)
2227    if (Math.abs(n + this.a * this.lat0) <= G)
2228      t = U(s / this.a + this.long0), i = 0;
2229    else {
2230      o = this.lat0 + n / this.a, a = s * s / this.a / this.a + o * o, l = o;
2231      var c;
2232      for (r = Pc; r; --r)
2233        if (c = Math.tan(l), h = -1 * (o * (l * c + 1) - l - 0.5 * (l * l + a) * c) / ((l - o) / c - 1), l += h, Math.abs(h) <= G) {
2234          i = l;
2235          break;
2236        }
2237      t = U(this.long0 + Math.asin(s * Math.tan(l) / this.a) / Math.sin(i));
2238    }
2239  else if (Math.abs(n + this.ml0) <= G)
2240    i = 0, t = U(this.long0 + s / this.a);
2241  else {
2242    o = (this.ml0 + n) / this.a, a = s * s / this.a / this.a + o * o, l = o;
2243    var u, d, f, g, _;
2244    for (r = Pc; r; --r)
2245      if (_ = this.e * Math.sin(l), u = Math.sqrt(1 - _ * _) * Math.tan(l), d = this.a * ue(this.e0, this.e1, this.e2, this.e3, l), f = this.e0 - 2 * this.e1 * Math.cos(2 * l) + 4 * this.e2 * Math.cos(4 * l) - 6 * this.e3 * Math.cos(6 * l), g = d / this.a, h = (o * (u * g + 1) - g - 0.5 * u * (g * g + a)) / (this.es * Math.sin(2 * l) * (g * g + a - 2 * o * g) / (4 * u) + (o - g) * (u * f - 2 / Math.sin(2 * l)) - f), l -= h, Math.abs(h) <= G) {
2246        i = l;
2247        break;
2248      }
2249    u = Math.sqrt(1 - this.es * Math.pow(Math.sin(i), 2)) * Math.tan(i), t = U(this.long0 + Math.asin(s * u / this.a) / Math.sin(i));
2250  }
2251  return e.x = t, e.y = i, e;
2252}
2253var Mp = ["Polyconic", "poly"];
2254const Cp = {
2255  init: xp,
2256  forward: vp,
2257  inverse: Ep,
2258  names: Mp
2259};
2260function bp() {
2261  this.A = [], this.A[1] = 0.6399175073, this.A[2] = -0.1358797613, this.A[3] = 0.063294409, this.A[4] = -0.02526853, this.A[5] = 0.0117879, this.A[6] = -55161e-7, this.A[7] = 26906e-7, this.A[8] = -1333e-6, this.A[9] = 67e-5, this.A[10] = -34e-5, this.B_re = [], this.B_im = [], this.B_re[1] = 0.7557853228, this.B_im[1] = 0, this.B_re[2] = 0.249204646, this.B_im[2] = 3371507e-9, this.B_re[3] = -1541739e-9, this.B_im[3] = 0.04105856, this.B_re[4] = -0.10162907, this.B_im[4] = 0.01727609, this.B_re[5] = -0.26623489, this.B_im[5] = -0.36249218, this.B_re[6] = -0.6870983, this.B_im[6] = -1.1651967, this.C_re = [], this.C_im = [], this.C_re[1] = 1.3231270439, this.C_im[1] = 0, this.C_re[2] = -0.577245789, this.C_im[2] = -7809598e-9, this.C_re[3] = 0.508307513, this.C_im[3] = -0.112208952, this.C_re[4] = -0.15094762, this.C_im[4] = 0.18200602, this.C_re[5] = 1.01418179, this.C_im[5] = 1.64497696, this.C_re[6] = 1.9660549, this.C_im[6] = 2.5127645, this.D = [], this.D[1] = 1.5627014243, this.D[2] = 0.5185406398, this.D[3] = -0.03333098, this.D[4] = -0.1052906, this.D[5] = -0.0368594, this.D[6] = 7317e-6, this.D[7] = 0.0122, this.D[8] = 394e-5, this.D[9] = -13e-4;
2262}
2263function wp(e) {
2264  var t, i = e.x, s = e.y, n = s - this.lat0, r = i - this.long0, o = n / Kn * 1e-5, a = r, l = 1, h = 0;
2265  for (t = 1; t <= 10; t++)
2266    l = l * o, h = h + this.A[t] * l;
2267  var c = h, u = a, d = 1, f = 0, g, _, m = 0, p = 0;
2268  for (t = 1; t <= 6; t++)
2269    g = d * c - f * u, _ = f * c + d * u, d = g, f = _, m = m + this.B_re[t] * d - this.B_im[t] * f, p = p + this.B_im[t] * d + this.B_re[t] * f;
2270  return e.x = p * this.a + this.x0, e.y = m * this.a + this.y0, e;
2271}
2272function Sp(e) {
2273  var t, i = e.x, s = e.y, n = i - this.x0, r = s - this.y0, o = r / this.a, a = n / this.a, l = 1, h = 0, c, u, d = 0, f = 0;
2274  for (t = 1; t <= 6; t++)
2275    c = l * o - h * a, u = h * o + l * a, l = c, h = u, d = d + this.C_re[t] * l - this.C_im[t] * h, f = f + this.C_im[t] * l + this.C_re[t] * h;
2276  for (var g = 0; g < this.iterations; g++) {
2277    var _ = d, m = f, p, y, v = o, E = a;
2278    for (t = 2; t <= 6; t++)
2279      p = _ * d - m * f, y = m * d + _ * f, _ = p, m = y, v = v + (t - 1) * (this.B_re[t] * _ - this.B_im[t] * m), E = E + (t - 1) * (this.B_im[t] * _ + this.B_re[t] * m);
2280    _ = 1, m = 0;
2281    var C = this.B_re[1], w = this.B_im[1];
2282    for (t = 2; t <= 6; t++)
2283      p = _ * d - m * f, y = m * d + _ * f, _ = p, m = y, C = C + t * (this.B_re[t] * _ - this.B_im[t] * m), w = w + t * (this.B_im[t] * _ + this.B_re[t] * m);
2284    var O = C * C + w * w;
2285    d = (v * C + E * w) / O, f = (E * C - v * w) / O;
2286  }
2287  var R = d, j = f, $ = 1, V = 0;
2288  for (t = 1; t <= 9; t++)
2289    $ = $ * R, V = V + this.D[t] * $;
2290  var tt = this.lat0 + V * Kn * 1e5, J = this.long0 + j;
2291  return e.x = J, e.y = tt, e;
2292}
2293var Tp = ["New_Zealand_Map_Grid", "nzmg"];
2294const Rp = {
2295  init: bp,
2296  forward: wp,
2297  inverse: Sp,
2298  names: Tp
2299};
2300function Ip() {
2301}
2302function Pp(e) {
2303  var t = e.x, i = e.y, s = U(t - this.long0), n = this.x0 + this.a * s, r = this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + i / 2.5)) * 1.25;
2304  return e.x = n, e.y = r, e;
2305}
2306function Ap(e) {
2307  e.x -= this.x0, e.y -= this.y0;
2308  var t = U(this.long0 + e.x / this.a), i = 2.5 * (Math.atan(Math.exp(0.8 * e.y / this.a)) - Math.PI / 4);
2309  return e.x = t, e.y = i, e;
2310}
2311var Lp = ["Miller_Cylindrical", "mill"];
2312const Op = {
2313  init: Ip,
2314  forward: Pp,
2315  inverse: Ap,
2316  names: Lp
2317};
2318var Fp = 20;
2319function kp() {
2320  this.sphere ? (this.n = 1, this.m = 0, this.es = 0, this.C_y = Math.sqrt((this.m + 1) / this.n), this.C_x = this.C_y / (this.m + 1)) : this.en = Id(this.es);
2321}
2322function Dp(e) {
2323  var t, i, s = e.x, n = e.y;
2324  if (s = U(s - this.long0), this.sphere) {
2325    if (!this.m)
2326      n = this.n !== 1 ? Math.asin(this.n * Math.sin(n)) : n;
2327    else
2328      for (var r = this.n * Math.sin(n), o = Fp; o; --o) {
2329        var a = (this.m * n + Math.sin(n) - r) / (this.m + Math.cos(n));
2330        if (n -= a, Math.abs(a) < G)
2331          break;
2332      }
2333    t = this.a * this.C_x * s * (this.m + Math.cos(n)), i = this.a * this.C_y * n;
2334  } else {
2335    var l = Math.sin(n), h = Math.cos(n);
2336    i = this.a * qo(n, l, h, this.en), t = this.a * s * h / Math.sqrt(1 - this.es * l * l);
2337  }
2338  return e.x = t, e.y = i, e;
2339}
2340function Np(e) {
2341  var t, i, s, n;
2342  return e.x -= this.x0, s = e.x / this.a, e.y -= this.y0, t = e.y / this.a, this.sphere ? (t /= this.C_y, s = s / (this.C_x * (this.m + Math.cos(t))), this.m ? t = Zi((this.m * t + Math.sin(t)) / this.n) : this.n !== 1 && (t = Zi(Math.sin(t) / this.n)), s = U(s + this.long0), t = Sn(t)) : (t = Pd(e.y / this.a, this.es, this.en), n = Math.abs(t), n < A ? (n = Math.sin(t), i = this.long0 + e.x * Math.sqrt(1 - this.es * n * n) / (this.a * Math.cos(t)), s = U(i)) : n - G < A && (s = this.long0)), e.x = s, e.y = t, e;
2343}
2344var Gp = ["Sinusoidal", "sinu"];
2345const zp = {
2346  init: kp,
2347  forward: Dp,
2348  inverse: Np,
2349  names: Gp
2350};
2351function jp() {
2352}
2353function Wp(e) {
2354  for (var t = e.x, i = e.y, s = U(t - this.long0), n = i, r = Math.PI * Math.sin(i); ; ) {
2355    var o = -(n + Math.sin(n) - r) / (1 + Math.cos(n));
2356    if (n += o, Math.abs(o) < G)
2357      break;
2358  }
2359  n /= 2, Math.PI / 2 - Math.abs(i) < G && (s = 0);
2360  var a = 0.900316316158 * this.a * s * Math.cos(n) + this.x0, l = 1.4142135623731 * this.a * Math.sin(n) + this.y0;
2361  return e.x = a, e.y = l, e;
2362}
2363function Bp(e) {
2364  var t, i;
2365  e.x -= this.x0, e.y -= this.y0, i = e.y / (1.4142135623731 * this.a), Math.abs(i) > 0.999999999999 && (i = 0.999999999999), t = Math.asin(i);
2366  var s = U(this.long0 + e.x / (0.900316316158 * this.a * Math.cos(t)));
2367  s < -Math.PI && (s = -Math.PI), s > Math.PI && (s = Math.PI), i = (2 * t + Math.sin(2 * t)) / Math.PI, Math.abs(i) > 1 && (i = 1);
2368  var n = Math.asin(i);
2369  return e.x = s, e.y = n, e;
2370}
2371var Up = ["Mollweide", "moll"];
2372const Xp = {
2373  init: jp,
2374  forward: Wp,
2375  inverse: Bp,
2376  names: Up
2377};
2378function $p() {
2379  Math.abs(this.lat1 + this.lat2) < G || (this.lat2 = this.lat2 || this.lat1, this.temp = this.b / this.a, this.es = 1 - Math.pow(this.temp, 2), this.e = Math.sqrt(this.es), this.e0 = Mr(this.es), this.e1 = Cr(this.es), this.e2 = br(this.es), this.e3 = wr(this.es), this.sinphi = Math.sin(this.lat1), this.cosphi = Math.cos(this.lat1), this.ms1 = ti(this.e, this.sinphi, this.cosphi), this.ml1 = ue(this.e0, this.e1, this.e2, this.e3, this.lat1), Math.abs(this.lat1 - this.lat2) < G ? this.ns = this.sinphi : (this.sinphi = Math.sin(this.lat2), this.cosphi = Math.cos(this.lat2), this.ms2 = ti(this.e, this.sinphi, this.cosphi), this.ml2 = ue(this.e0, this.e1, this.e2, this.e3, this.lat2), this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1)), this.g = this.ml1 + this.ms1 / this.ns, this.ml0 = ue(this.e0, this.e1, this.e2, this.e3, this.lat0), this.rh = this.a * (this.g - this.ml0));
2380}
2381function Yp(e) {
2382  var t = e.x, i = e.y, s;
2383  if (this.sphere)
2384    s = this.a * (this.g - i);
2385  else {
2386    var n = ue(this.e0, this.e1, this.e2, this.e3, i);
2387    s = this.a * (this.g - n);
2388  }
2389  var r = this.ns * U(t - this.long0), o = this.x0 + s * Math.sin(r), a = this.y0 + this.rh - s * Math.cos(r);
2390  return e.x = o, e.y = a, e;
2391}
2392function Kp(e) {
2393  e.x -= this.x0, e.y = this.rh - e.y + this.y0;
2394  var t, i, s, n;
2395  this.ns >= 0 ? (i = Math.sqrt(e.x * e.x + e.y * e.y), t = 1) : (i = -Math.sqrt(e.x * e.x + e.y * e.y), t = -1);
2396  var r = 0;
2397  if (i !== 0 && (r = Math.atan2(t * e.x, t * e.y)), this.sphere)
2398    return n = U(this.long0 + r / this.ns), s = Sn(this.g - i / this.a), e.x = n, e.y = s, e;
2399  var o = this.g - i / this.a;
2400  return s = Mo(o, this.e0, this.e1, this.e2, this.e3), n = U(this.long0 + r / this.ns), e.x = n, e.y = s, e;
2401}
2402var qp = ["Equidistant_Conic", "eqdc"];
2403const Vp = {
2404  init: $p,
2405  forward: Yp,
2406  inverse: Kp,
2407  names: qp
2408};
2409function Hp() {
2410  this.R = this.a;
2411}
2412function Zp(e) {
2413  var t = e.x, i = e.y, s = U(t - this.long0), n, r;
2414  Math.abs(i) <= G && (n = this.x0 + this.R * s, r = this.y0);
2415  var o = Zi(2 * Math.abs(i / Math.PI));
2416  (Math.abs(s) <= G || Math.abs(Math.abs(i) - A) <= G) && (n = this.x0, i >= 0 ? r = this.y0 + Math.PI * this.R * Math.tan(0.5 * o) : r = this.y0 + Math.PI * this.R * -Math.tan(0.5 * o));
2417  var a = 0.5 * Math.abs(Math.PI / s - s / Math.PI), l = a * a, h = Math.sin(o), c = Math.cos(o), u = c / (h + c - 1), d = u * u, f = u * (2 / h - 1), g = f * f, _ = Math.PI * this.R * (a * (u - g) + Math.sqrt(l * (u - g) * (u - g) - (g + l) * (d - g))) / (g + l);
2418  s < 0 && (_ = -_), n = this.x0 + _;
2419  var m = l + u;
2420  return _ = Math.PI * this.R * (f * m - a * Math.sqrt((g + l) * (l + 1) - m * m)) / (g + l), i >= 0 ? r = this.y0 + _ : r = this.y0 - _, e.x = n, e.y = r, e;
2421}
2422function Jp(e) {
2423  var t, i, s, n, r, o, a, l, h, c, u, d, f;
2424  return e.x -= this.x0, e.y -= this.y0, u = Math.PI * this.R, s = e.x / u, n = e.y / u, r = s * s + n * n, o = -Math.abs(n) * (1 + r), a = o - 2 * n * 
2424n + s * s, l = -2 * o + 1 + 2 * n * n + r * r, f = n * n / l + (2 * a * a * a / l / l / l - 9 * o * a / l / l) / 27, h = (o - a * a / 3 / l) / l, c = 2 * Math.sqrt(-h / 3), u = 3 * f / h / c, Math.abs(u) > 1 && (u >= 0 ? u = 1 : u = -1), d = Math.acos(u) / 3, e.y >= 0 ? i = (-c * Math.cos(d + Math.PI / 3) - a / 3 / l) * Math.PI : i = -(-c * Math.cos(d + Math.PI / 3) - a / 3 / l) * Math.PI, Math.abs(s) < G ? t = this.long0 : t = U(this.long0 + Math.PI * (r - 1 + Math.sqrt(1 + 2 * (s * s - n * n) + r * r)) / 2 / s), e.x = t, e.y = i, e;
2425}
2426var Qp = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
2427const ty = {
2428  init: Hp,
2429  forward: Zp,
2430  inverse: Jp,
2431  names: Qp
2432};
2433function ey() {
2434  this.sin_p12 = Math.sin(this.lat0), this.cos_p12 = Math.cos(this.lat0);
2435}
2436function iy(e) {
2437  var t = e.x, i = e.y, s = Math.sin(e.y), n = Math.cos(e.y), r = U(t - this.long0), o, a, l, h, c, u, d, f, g, _, m, p, y, v, E, C, w, O, R, j, $, V, tt;
2438  return this.sphere ? Math.abs(this.sin_p12 - 1) <= G ? (e.x = this.x0 + this.a * (A - i) * Math.sin(r), e.y = this.y0 - this.a * (A - i) * Math.cos(r), e) : Math.abs(this.sin_p12 + 1) <= G ? (e.x = this.x0 + this.a * (A + i) * Math.sin(r), e.y = this.y0 + this.a * (A + i) * Math.cos(r), e) : (O = this.sin_p12 * s + this.cos_p12 * n * Math.cos(r), C = Math.acos(O), w = C ? C / Math.sin(C) : 1, e.x = this.x0 + this.a * w * n * Math.sin(r), e.y = this.y0 + this.a * w * (this.cos_p12 * s - this.sin_p12 * n * Math.cos(r)), e) : (o = Mr(this.es), a = Cr(this.es), l = br(this.es), h = wr(this.es), Math.abs(this.sin_p12 - 1) <= G ? (c = this.a * ue(o, a, l, h, A), u = this.a * ue(o, a, l, h, i), e.x = this.x0 + (c - u) * Math.sin(r), e.y = this.y0 - (c - u) * Math.cos(r), e) : Math.abs(this.sin_p12 + 1) <= G ? (c = this.a * ue(o, a, l, h, A), u = this.a * ue(o, a, l, h, i), e.x = this.x0 + (c + u) * Math.sin(r), e.y = this.y0 + (c + u) * Math.cos(r), e) : (d = s / n, f = gn(this.a, this.e, this.sin_p12), g = gn(this.a, this.e, s), _ = Math.atan((1 - this.es) * d + this.es * f * this.sin_p12 / (g * n)), m = Math.atan2(Math.sin(r), this.cos_p12 * Math.tan(_) - this.sin_p12 * Math.cos(r)), m === 0 ? R = Math.asin(this.cos_p12 * Math.sin(_) - this.sin_p12 * Math.cos(_)) : Math.abs(Math.abs(m) - Math.PI) <= G ? R = -Math.asin(this.cos_p12 * Math.sin(_) - this.sin_p12 * Math.cos(_)) : R = Math.asin(Math.sin(r) * Math.cos(_) / Math.sin(m)), p = this.e * this.sin_p12 / Math.sqrt(1 - this.es), y = this.e * this.cos_p12 * Math.cos(m) / Math.sqrt(1 - this.es), v = p * y, E = y * y, j = R * R, $ = j * R, V = $ * R, tt = V * R, C = f * R * (1 - j * E * (1 - E) / 6 + $ / 8 * v * (1 - 2 * E) + V / 120 * (E * (4 - 7 * E) - 3 * p * p * (1 - 7 * E)) - tt / 48 * v), e.x = this.x0 + C * Math.sin(m), e.y = this.y0 + C * Math.cos(m), e));
2439}
2440function sy(e) {
2441  e.x -= this.x0, e.y -= this.y0;
2442  var t, i, s, n, r, o, a, l, h, c, u, d, f, g, _, m, p, y, v, E, C, w, O, R;
2443  return this.sphere ? (t = Math.sqrt(e.x * e.x + e.y * e.y), t > 2 * A * this.a ? void 0 : (i = t / this.a, s = Math.sin(i), n = Math.cos(i), r = this.long0, Math.abs(t) <= G ? o = this.lat0 : (o = Zi(n * this.sin_p12 + e.y * s * this.cos_p12 / t), a = Math.abs(this.lat0) - A, Math.abs(a) <= G ? this.lat0 >= 0 ? r = U(this.long0 + Math.atan2(e.x, -e.y)) : r = U(this.long0 - Math.atan2(-e.x, e.y)) : r = U(this.long0 + Math.atan2(e.x * s, t * this.cos_p12 * n - e.y * this.sin_p12 * s))), e.x = r, e.y = o, e)) : (l = Mr(this.es), h = Cr(this.es), c = br(this.es), u = wr(this.es), Math.abs(this.sin_p12 - 1) <= G ? (d = this.a * ue(l, h, c, u, A), t = Math.sqrt(e.x * e.x + e.y * e.y), f = d - t, o = Mo(f / this.a, l, h, c, u), r = U(this.long0 + Math.atan2(e.x, -1 * e.y)), e.x = r, e.y = o, e) : Math.abs(this.sin_p12 + 1) <= G ? (d = this.a * ue(l, h, c, u, A), t = Math.sqrt(e.x * e.x + e.y * e.y), f = t - d, o = Mo(f / this.a, l, h, c, u), r = U(this.long0 + Math.atan2(e.x, e.y)), e.x = r, e.y = o, e) : (t = Math.sqrt(e.x * e.x + e.y * e.y), m = Math.atan2(e.x, e.y), g = gn(this.a, this.e, this.sin_p12), p = Math.cos(m), y = this.e * this.cos_p12 * p, v = -y * y / (1 - this.es), E = 3 * this.es * (1 - v) * this.sin_p12 * this.cos_p12 * p / (1 - this.es), C = t / g, w = C - v * (1 + v) * Math.pow(C, 3) / 6 - E * (1 + 3 * v) * Math.pow(C, 4) / 24, O = 1 - v * w * w / 2 - C * w * w * w / 6, _ = Math.asin(this.sin_p12 * Math.cos(w) + this.cos_p12 * Math.sin(w) * p), r = U(this.long0 + Math.asin(Math.sin(m) * Math.sin(w) / Math.cos(_))), R = Math.sin(_), o = Math.atan2((R - this.es * O * this.sin_p12) * Math.tan(_), R * (1 - this.es)), e.x = r, e.y = o, e));
2444}
2445var ny = ["Azimuthal_Equidistant", "aeqd"];
2446const ry = {
2447  init: ey,
2448  forward: iy,
2449  inverse: sy,
2450  names: ny
2451};
2452function oy() {
vendor: 14,553 bytes, lines 2453-2760
2453  this.sin_p14 = Math.sin(this.lat0), this.cos_p14 = Math.cos(this.lat0);
2454}
2455function ay(e) {
2456  var t, i, s, n, r, o, a, l, h = e.x, c = e.y;
2457  return s = U(h - this.long0), t = Math.sin(c), i = Math.cos(c), n = Math.cos(s), o = this.sin_p14 * t + this.cos_p14 * i * n, r = 1, (o > 0 || Math.abs(o) <= G) && (a = this.a * r * i * Math.sin(s), l = this.y0 + this.a * r * (this.cos_p14 * t - this.sin_p14 * i * n)), e.x = a, e.y = l, e;
2458}
2459function ly(e) {
2460  var t, i, s, n, r, o, a;
2461  return e.x -= this.x0, e.y -= this.y0, t = Math.sqrt(e.x * e.x + e.y * e.y), i = Zi(t / this.a), s = Math.sin(i), n = Math.cos(i), o = this.long0, Math.abs(t) <= G ? (a = this.lat0, e.x = o, e.y = a, e) : (a = Zi(n * this.sin_p14 + e.y * s * this.cos_p14 / t), r = Math.abs(this.lat0) - A, Math.abs(r) <= G ? (this.lat0 >= 0 ? o = U(this.long0 + Math.atan2(e.x, -e.y)) : o = U(this.long0 - Math.atan2(-e.x, e.y)), e.x = o, e.y = a, e) : (o = U(this.long0 + Math.atan2(e.x * s, t * this.cos_p14 * n - e.y * this.sin_p14 * s)), e.x = o, e.y = a, e));
2462}
2463var hy = ["ortho"];
2464const cy = {
2465  init: oy,
2466  forward: ay,
2467  inverse: ly,
2468  names: hy
2469};
2470var Lt = {
2471  FRONT: 1,
2472  RIGHT: 2,
2473  BACK: 3,
2474  LEFT: 4,
2475  TOP: 5,
2476  BOTTOM: 6
2477}, xt = {
2478  AREA_0: 1,
2479  AREA_1: 2,
2480  AREA_2: 3,
2481  AREA_3: 4
2482};
2483function uy() {
2484  this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.lat0 = this.lat0 || 0, this.long0 = this.long0 || 0, this.lat_ts = this.lat_ts || 0, this.title = this.title || "Quadrilateralized Spherical Cube", this.lat0 >= A - yt / 2 ? this.face = Lt.TOP : this.lat0 <= -(A - yt / 2) ? this.face = Lt.BOTTOM : Math.abs(this.long0) <= yt ? this.face = Lt.FRONT : Math.abs(this.long0) <= A + yt ? this.face = this.long0 > 0 ? Lt.RIGHT : Lt.LEFT : this.face = Lt.BACK, this.es !== 0 && (this.one_minus_f = 1 - (this.a - this.b) / this.a, this.one_minus_f_squared = this.one_minus_f * this.one_minus_f);
2485}
2486function dy(e) {
2487  var t = { x: 0, y: 0 }, i, s, n, r, o, a, l = { value: 0 };
2488  if (e.x -= this.long0, this.es !== 0 ? i = Math.atan(this.one_minus_f_squared * Math.tan(e.y)) : i = e.y, s = e.x, this.face === Lt.TOP)
2489    r = A - i, s >= yt && s <= A + yt ? (l.value = xt.AREA_0, n = s - A) : s > A + yt || s <= -(A + yt) ? (l.value = xt.AREA_1, n = s > 0 ? s - Dt : s + Dt) : s > -(A + yt) && s <= -yt ? (l.value = xt.AREA_2, n = s + A) : (l.value = xt.AREA_3, n = s);
2490  else if (this.face === Lt.BOTTOM)
2491    r = A + i, s >= yt && s <= A + yt ? (l.value = xt.AREA_0, n = -s + A) : s < yt && s >= -yt ? (l.value = xt.AREA_1, n = -s) : s < -yt && s >= -(A + yt) ? (l.value = xt.AREA_2, n = -s - A) : (l.value = xt.AREA_3, n = s > 0 ? -s + Dt : -s - Dt);
2492  else {
2493    var h, c, u, d, f, g, _;
2494    this.face === Lt.RIGHT ? s = nn(s, +A) : this.face === Lt.BACK ? s = nn(s, +Dt) : this.face === Lt.LEFT && (s = nn(s, -A)), d = Math.sin(i), f = Math.cos(i), g = Math.sin(s), _ = Math.cos(s), h = f * _, c = f * g, u = d, this.face === Lt.FRONT ? (r = Math.acos(h), n = Wr(r, u, c, l)) : this.face === Lt.RIGHT ? (r = Math.acos(c), n = Wr(r, u, -h, l)) : this.face === Lt.BACK ? (r = Math.acos(-h), n = Wr(r, u, -c, l)) : this.face === Lt.LEFT ? (r = Math.acos(-c), n = Wr(r, u, h, l)) : (r = n = 0, l.value = xt.AREA_0);
2495  }
2496  return a = Math.atan(12 / Dt * (n + Math.acos(Math.sin(n) * Math.cos(yt)) - A)), o = Math.sqrt((1 - Math.cos(r)) / (Math.cos(a) * Math.cos(a)) / (1 - Math.cos(Math.atan(1 / Math.cos(n))))), l.value === xt.AREA_1 ? a += A : l.value === xt.AREA_2 ? a += Dt : l.value === xt.AREA_3 && (a += 1.5 * Dt), t.x = o * Math.cos(a), t.y = o * Math.sin(a), t.x = t.x * this.a + this.x0, t.y = t.y * this.a + this.y0, e.x = t.x, e.y = t.y, e;
2497}
2498function fy(e) {
2499  var t = { lam: 0, phi: 0 }, i, s, n, r, o, a, l, h, c, u = { value: 0 };
2500  if (e.x = (e.x - this.x0) / this.a, e.y = (e.y - this.y0) / this.a, s = Math.atan(Math.sqrt(e.x * e.x + e.y * e.y)), i = Math.atan2(e.y, e.x), e.x >= 0 && e.x >= Math.abs(e.y) ? u.value = xt.AREA_0 : e.y >= 0 && e.y >= Math.abs(e.x) ? (u.value = xt.AREA_1, i -= A) : e.x < 0 && -e.x >= Math.abs(e.y) ? (u.value = xt.AREA_2, i = i < 0 ? i + Dt : i - Dt) : (u.value = xt.AREA_3, i += A), c = Dt / 12 * Math.tan(i), o = Math.sin(c) / (Math.cos(c) - 1 / Math.sqrt(2)), a = Math.atan(o), n = Math.cos(i), r = Math.tan(s), l = 1 - n * n * r * r * (1 - Math.cos(Math.atan(1 / Math.cos(a)))), l < -1 ? l = -1 : l > 1 && (l = 1), this.face === Lt.TOP)
2501    h = Math.acos(l), t.phi = A - h, u.value === xt.AREA_0 ? t.lam = a + A : u.value === xt.AREA_1 ? t.lam = a < 0 ? a + Dt : a - Dt : u.value === xt.AREA_2 ? t.lam = a - A : t.lam = a;
2502  else if (this.face === Lt.BOTTOM)
2503    h = Math.acos(l), t.phi = h - A, u.value === xt.AREA_0 ? t.lam = -a + A : u.value === xt.AREA_1 ? t.lam = -a : u.value === xt.AREA_2 ? t.lam = -a - A : t.lam = a < 0 ? -a - Dt : -a + Dt;
2504  else {
2505    var d, f, g;
2506    d = l, c = d * d, c >= 1 ? g = 0 : g = Math.sqrt(1 - c) * Math.sin(a), c += g * g, c >= 1 ? f = 0 : f = Math.sqrt(1 - c), u.value === xt.AREA_1 ? (c = f, f = -g, g = c) : u.value === xt.AREA_2 ? (f = -f, g = -g) : u.value === xt.AREA_3 && (c = f, f = g, g = -c), this.face === Lt.RIGHT ? (c = d, d = -f, f = c) : this.face === Lt.BACK ? (d = -d, f = -f) : this.face === Lt.LEFT && (c = d, d = f, f = -c), t.phi = Math.acos(-g) - A, t.lam = Math.atan2(f, d), this.face === Lt.RIGHT ? t.lam = nn(t.lam, -A) : this.face === Lt.BACK ? t.lam = nn(t.lam, -Dt) : this.face === Lt.LEFT && (t.lam = nn(t.lam, +A));
2507  }
2508  if (this.es !== 0) {
2509    var _, m, p;
2510    _ = t.phi < 0 ? 1 : 0, m = Math.tan(t.phi), p = this.b / Math.sqrt(m * m + this.one_minus_f_squared), t.phi = Math.atan(Math.sqrt(this.a * this.a - p * p) / (this.one_minus_f * p)), _ && (t.phi = -t.phi);
2511  }
2512  return t.lam += this.long0, e.x = t.lam, e.y = t.phi, e;
2513}
2514function Wr(e, t, i, s) {
2515  var n;
2516  return e < G ? (s.value = xt.AREA_0, n = 0) : (n = Math.atan2(t, i), Math.abs(n) <= yt ? s.value = xt.AREA_0 : n > yt && n <= A + yt ? (s.value = xt.AREA_1, n -= A) : n > A + yt || n <= -(A + yt) ? (s.value = xt.AREA_2, n = n >= 0 ? n - Dt : n + Dt) : (s.value = xt.AREA_3, n += A)), n;
2517}
2518function nn(e, t) {
2519  var i = e + t;
2520  return i < -Dt ? i += tr : i > +Dt && (i -= tr), i;
2521}
2522var gy = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
2523const _y = {
2524  init: uy,
2525  forward: dy,
2526  inverse: fy,
2527  names: gy
2528};
2529var ol = [
2530  [1, 22199e-21, -715515e-10, 31103e-10],
2531  [0.9986, -482243e-9, -24897e-9, -13309e-10],
2532  [0.9954, -83103e-8, -448605e-10, -986701e-12],
2533  [0.99, -135364e-8, -59661e-9, 36777e-10],
2534  [0.9822, -167442e-8, -449547e-11, -572411e-11],
2535  [0.973, -214868e-8, -903571e-10, 18736e-12],
2536  [0.96, -305085e-8, -900761e-10, 164917e-11],
2537  [0.9427, -382792e-8, -653386e-10, -26154e-10],
2538  [0.9216, -467746e-8, -10457e-8, 481243e-11],
2539  [0.8962, -536223e-8, -323831e-10, -543432e-11],
2540  [0.8679, -609363e-8, -113898e-9, 332484e-11],
2541  [0.835, -698325e-8, -640253e-10, 934959e-12],
2542  [0.7986, -755338e-8, -500009e-10, 935324e-12],
2543  [0.7597, -798324e-8, -35971e-9, -227626e-11],
2544  [0.7186, -851367e-8, -701149e-10, -86303e-10],
2545  [0.6732, -986209e-8, -199569e-9, 191974e-10],
2546  [0.6213, -0.010418, 883923e-10, 624051e-11],
2547  [0.5722, -906601e-8, 182e-6, 624051e-11],
2548  [0.5322, -677797e-8, 275608e-9, 624051e-11]
2549], Bn = [
2550  [-520417e-23, 0.0124, 121431e-23, -845284e-16],
2551  [0.062, 0.0124, -126793e-14, 422642e-15],
2552  [0.124, 0.0124, 507171e-14, -160604e-14],
2553  [0.186, 0.0123999, -190189e-13, 600152e-14],
2554  [0.248, 0.0124002, 710039e-13, -224e-10],
2555  [0.31, 0.0123992, -264997e-12, 835986e-13],
2556  [0.372, 0.0124029, 988983e-12, -311994e-12],
2557  [0.434, 0.0123893, -369093e-11, -435621e-12],
2558  [0.4958, 0.0123198, -102252e-10, -345523e-12],
2559  [0.5571, 0.0121916, -154081e-10, -582288e-12],
2560  [0.6176, 0.0119938, -241424e-10, -525327e-12],
2561  [0.6769, 0.011713, -320223e-10, -516405e-12],
2562  [0.7346, 0.0113541, -397684e-10, -609052e-12],
2563  [0.7903, 0.0109107, -489042e-10, -104739e-11],
2564  [0.8435, 0.0103431, -64615e-9, -140374e-14],
2565  [0.8936, 969686e-8, -64636e-9, -8547e-9],
2566  [0.9394, 840947e-8, -192841e-9, -42106e-10],
2567  [0.9761, 616527e-8, -256e-6, -42106e-10],
2568  [1, 328947e-8, -319159e-9, -42106e-10]
2569], Od = 0.8487, Fd = 1.3523, kd = Ni / 5, my = 1 / kd, Hs = 18, Co = function(e, t) {
2570  return e[0] + t * (e[1] + t * (e[2] + t * e[3]));
2571}, py = function(e, t) {
2572  return e[1] + t * (2 * e[2] + t * 3 * e[3]);
2573};
2574function yy(e, t, i, s) {
2575  for (var n = t; s; --s) {
2576    var r = e(n);
2577    if (n -= r, Math.abs(r) < i)
2578      break;
2579  }
2580  return n;
2581}
2582function xy() {
2583  this.x0 = this.x0 || 0, this.y0 = this.y0 || 0, this.long0 = this.long0 || 0, this.es = 0, this.title = this.title || "Robinson";
2584}
2585function vy(e) {
2586  var t = U(e.x - this.long0), i = Math.abs(e.y), s = Math.floor(i * kd);
2587  s < 0 ? s = 0 : s >= Hs && (s = Hs - 1), i = Ni * (i - my * s);
2588  var n = {
2589    x: Co(ol[s], i) * t,
2590    y: Co(Bn[s], i)
2591  };
2592  return e.y < 0 && (n.y = -n.y), n.x = n.x * this.a * Od + this.x0, n.y = n.y * this.a * Fd + this.y0, n;
2593}
2594function Ey(e) {
2595  var t = {
2596    x: (e.x - this.x0) / (this.a * Od),
2597    y: Math.abs(e.y - this.y0) / (this.a * Fd)
2598  };
2599  if (t.y >= 1)
2600    t.x /= ol[Hs][0], t.y = e.y < 0 ? -A : A;
2601  else {
2602    var i = Math.floor(t.y * Hs);
2603    for (i < 0 ? i = 0 : i >= Hs && (i = Hs - 1); ; )
2604      if (Bn[i][0] > t.y)
2605        --i;
2606      else if (Bn[i + 1][0] <= t.y)
2607        ++i;
2608      else
2609        break;
2610    var s = Bn[i], n = 5 * (t.y - s[0]) / (Bn[i + 1][0] - s[0]);
2611    n = yy(function(r) {
2612      return (Co(s, r) - t.y) / py(s, r);
2613    }, n, G, 100), t.x /= Co(ol[i], n), t.y = (5 * i + n) * qt, e.y < 0 && (t.y = -t.y);
2614  }
2615  return t.x = U(t.x + this.long0), t;
2616}
2617var My = ["Robinson", "robin"];
2618const Cy = {
2619  init: xy,
2620  forward: vy,
2621  inverse: Ey,
2622  names: My
2623};
2624function by() {
2625  this.name = "geocent";
2626}
2627function wy(e) {
2628  var t = vd(e, this.es, this.a);
2629  return t;
2630}
2631function Sy(e) {
2632  var t = Ed(e, this.es, this.a, this.b);
2633  return t;
2634}
2635var Ty = ["Geocentric", "geocentric", "geocent", "Geocent"];
2636const Ry = {
2637  init: by,
2638  forward: wy,
2639  inverse: Sy,
2640  names: Ty
2641};
2642var te = {
2643  N_POLE: 0,
2644  S_POLE: 1,
2645  EQUIT: 2,
2646  OBLIQ: 3
2647}, Fn = {
2648  h: { def: 1e5, num: !0 },
2649  // default is Karman line, no default in PROJ.7
2650  azi: { def: 0, num: !0, degrees: !0 },
2651  // default is North
2652  tilt: { def: 0, num: !0, degrees: !0 },
2653  // default is Nadir
2654  long0: { def: 0, num: !0 },
2655  // default is Greenwich, conversion to rad is automatic
2656  lat0: { def: 0, num: !0 }
2657  // default is Equator, conversion to rad is automatic
2658};
2659function Iy() {
2660  if (Object.keys(Fn).forEach((function(i) {
2661    if (typeof this[i] > "u")
2662      this[i] = Fn[i].def;
2663    else {
2664      if (Fn[i].num && isNaN(this[i]))
2665        throw new Error("Invalid parameter value, must be numeric " + i + " = " + this[i]);
2666      Fn[i].num && (this[i] = parseFloat(this[i]));
2667    }
2668    Fn[i].degrees && (this[i] = this[i] * qt);
2669  }).bind(this)), Math.abs(Math.abs(this.lat0) - A) < G ? this.mode = this.lat0 < 0 ? te.S_POLE : te.N_POLE : Math.abs(this.lat0) < G ? this.mode = te.EQUIT : (this.mode = te.OBLIQ, this.sinph0 = Math.sin(this.lat0), this.cosph0 = Math.cos(this.lat0)), this.pn1 = this.h / this.a, this.pn1 <= 0 || this.pn1 > 1e10)
2670    throw new Error("Invalid height");
2671  this.p = 1 + this.pn1, this.rp = 1 / this.p, this.h1 = 1 / this.pn1, this.pfact = (this.p + 1) * this.h1, this.es = 0;
2672  var e = this.tilt, t = this.azi;
2673  this.cg = Math.cos(t), this.sg = Math.sin(t), this.cw = Math.cos(e), this.sw = Math.sin(e);
2674}
2675function Py(e) {
2676  e.x -= this.long0;
2677  var t = Math.sin(e.y), i = Math.cos(e.y), s = Math.cos(e.x), n, r;
2678  switch (this.mode) {
2679    case te.OBLIQ:
2680      r = this.sinph0 * t + this.cosph0 * i * s;
2681      break;
2682    case te.EQUIT:
2683      r = i * s;
2684      break;
2685    case te.S_POLE:
2686      r = -t;
2687      break;
2688    case te.N_POLE:
2689      r = t;
2690      break;
2691  }
2692  switch (r = this.pn1 / (this.p - r), n = r * i * Math.sin(e.x), this.mode) {
2693    case te.OBLIQ:
2694      r *= this.cosph0 * t - this.sinph0 * i * s;
2695      break;
2696    case te.EQUIT:
2697      r *= t;
2698      break;
2699    case te.N_POLE:
2700      r *= -(i * s);
2701      break;
2702    case te.S_POLE:
2703      r *= i * s;
2704      break;
2705  }
2706  var o, a;
2707  return o = r * this.cg + n * this.sg, a = 1 / (o * this.sw * this.h1 + this.cw), n = (n * this.cg - r * this.sg) * this.cw * a, r = o * a, e.x = n * this.a, e.y = r * this.a, e;
2708}
2709function Ay(e) {
2710  e.x /= this.a, e.y /= this.a;
2711  var t = { x: e.x, y: e.y }, i, s, n;
2712  n = 1 / (this.pn1 - e.y * this.sw), i = this.pn1 * e.x * n, s = this.pn1 * e.y * this.cw * n, e.x = i * this.cg + s * this.sg, e.y = s * this.cg - i * this.sg;
2713  var r = ke(e.x, e.y);
2714  if (Math.abs(r) < G)
2715    t.x = 0, t.y = e.y;
2716  else {
2717    var o, a;
2718    switch (a = 1 - r * r * this.pfact, a = (this.p - Math.sqrt(a)) / (this.pn1 / r + r / this.pn1), o = Math.sqrt(1 - a * a), this.mode) {
2719      case te.OBLIQ:
2720        t.y = Math.asin(o * this.sinph0 + e.y * a * this.cosph0 / r), e.y = (o - this.sinph0 * Math.sin(t.y)) * r, e.x *= a * this.cosph0;
2721        break;
2722      case te.EQUIT:
2723        t.y = Math.asin(e.y * a / r), e.y = o * r, e.x *= a;
2724        break;
2725      case te.N_POLE:
2726        t.y = Math.asin(o), e.y = -e.y;
2727        break;
2728      case te.S_POLE:
2729        t.y = -Math.asin(o);
2730        break;
2731    }
2732    t.x = Math.atan2(e.x, e.y);
2733  }
2734  return e.x = t.x + this.long0, e.y = t.y, e;
2735}
2736var Ly = ["Tilted_Perspective", "tpers"];
2737const Oy = {
2738  init: Iy,
2739  forward: Py,
2740  inverse: Ay,
2741  names: Ly
2742};
2743function Fy() {
2744  if (this.flip_axis = this.sweep === "x" ? 1 : 0, this.h = Number(this.h), this.radius_g_1 = this.h / this.a, this.radius_g_1 <= 0 || this.radius_g_1 > 1e10)
2745    throw new Error();
2746  if (this.radius_g = 1 + this.radius_g_1, this.C = this.radius_g * this.radius_g - 1, this.es !== 0) {
2747    var e = 1 - this.es, t = 1 / e;
2748    this.radius_p = Math.sqrt(e), this.radius_p2 = e, this.radius_p_inv2 = t, this.shape = "ellipse";
2749  } else
2750    this.radius_p = 1, this.radius_p2 = 1, this.radius_p_inv2 = 1, this.shape = "sphere";
2751  this.title || (this.title = "Geostationary Satellite View");
2752}
2753function ky(e) {
2754  var t = e.x, i = e.y, s, n, r, o;
2755  if (t = t - this.long0, this.shape === "ellipse") {
2756    i = Math.atan(this.radius_p2 * Math.tan(i));
2757    var a = this.radius_p / ke(this.radius_p * Math.cos(i), Math.sin(i));
2758    if (n = a * Math.cos(t) * Math.cos(i), r = a * Math.sin(t) * Math.cos(i), o = a * Math.sin(i), (this.radius_g - n) * n - r * r - o * o * this.radius_p_inv2 < 0)
2759      return e.x = Number.NaN, e.y = Number.NaN, e;
2760    s = this.radius_g - n, this.flip_axis ? (e.x = this.radius_g_1 * Math.atan(r / ke(o, s)
2760), e.y = this.radius_g_1 * Math.atan(o / s)) : (e.x = this.radius_g_1 * Math.atan(r / s), e.y = this.radius_g_1 * Math.atan(o / ke(r, s)));
2761  } else
2762    this.shape === "sphere" && (s = Math.cos(i), n = Math.cos(t) * s, r = Math.sin(t) * s, o = Math.sin(i), s = this.radius_g - n, this.flip_axis ? (e.x = this.radius_g_1 * Math.atan(r / ke(o, s)), e.y = this.radius_g_1 * Math.atan(o / s)) : (e.x = this.radius_g_1 * Math.atan(r / s), e.y = this.radius_g_1 * Math.atan(o / ke(r, s))));
2763  return e.x = e.x * this.a, e.y = e.y * this.a, e;
2764}
2765function Dy(e) {
2766  var t = -1, i = 0, s = 0, n, r, o, a;
2767  if (e.x = e.x / this.a, e.y = e.y / this.a, this.shape === "ellipse") {
2768    this.flip_axis ? (s = Math.tan(e.y / this.radius_g_1), i = Math.tan(e.x / this.radius_g_1) * ke(1, s)) : (i = Math.tan(e.x / this.radius_g_1), s = Math.tan(e.y / this.radius_g_1) * ke(1, i));
2769    var l = s / this.radius_p;
2770    if (n = i * i + l * l + t * t, r = 2 * this.radius_g * t, o = r * r - 4 * n * this.C, o < 0)
2771      return e.x = Number.NaN, e.y = Number.NaN, e;
2772    a = (-r - Math.sqrt(o)) / (2 * n), t = this.radius_g + a * t, i *= a, s *= a, e.x = Math.atan2(i, t), e.y = Math.atan(s * Math.cos(e.x) / t), e.y = Math.atan(this.radius_p_inv2 * Math.tan(e.y));
2773  } else if (this.shape === "sphere") {
2774    if (this.flip_axis ? (s = Math.tan(e.y / this.radius_g_1), i = Math.tan(e.x / this.radius_g_1) * Math.sqrt(1 + s * s)) : (i = Math.tan(e.x / this.radius_g_1), s = Math.tan(e.y / this.radius_g_1) * Math.sqrt(1 + i * i)), n = i * i + s * s + t * t, r = 2 * this.radius_g * t, o = r * r - 4 * n * this.C, o < 0)
2775      return e.x = Number.NaN, e.y = Number.NaN, e;
2776    a = (-r - Math.sqrt(o)) / (2 * n), t = this.radius_g + a * t, i *= a, s *= a, e.x = Math.atan2(i, t), e.y = Math.atan(s * Math.cos(e.x) / t);
2777  }
2778  return e.x = e.x + this.long0, e;
2779}
2780var Ny = ["Geostationary Satellite View", "Geostationary_Satellite", "geos"];
2781const Gy = {
2782  init: Fy,
2783  forward: ky,
2784  inverse: Dy,
2785  names: Ny
2786};
2787function zy(e) {
2788  e.Proj.projections.add(uo), e.Proj.projections.add(fo), e.Proj.projections.add($m), e.Proj.projections.add(e0), e.Proj.projections.add(a0), e.Proj.projections.add(d0), e.Proj.projections.add(y0), e.Proj.projections.add(C0), e.Proj.projections.add(R0), e.Proj.projections.add(O0), e.Proj.projections.add(H0), e.Proj.projections.add(ip), e.Proj.projections.add(ap), e.Proj.projections.add(fp), e.Proj.projections.add(yp), e.Proj.projections.add(Cp), e.Proj.projections.add(Rp), e.Proj.projections.add(Op), e.Proj.projections.add(zp), e.Proj.projections.add(Xp), e.Proj.projections.add(Vp), e.Proj.projections.add(ty), e.Proj.projections.add(ry), e.Proj.projections.add(cy), e.Proj.projections.add(_y), e.Proj.projections.add(Cy), e.Proj.projections.add(Ry), e.Proj.projections.add(Oy), e.Proj.projections.add(Gy);
2789}
2790xe.defaultDatum = "WGS84";
2791xe.Proj = Je;
2792xe.WGS84 = new xe.Proj("WGS84");
2793xe.Point = fn;
2794xe.toPoint = Md;
2795xe.defs = he;
2796xe.nadgrid = K_;
2797xe.transform = Eo;
2798xe.mgrs = hm;
2799xe.version = "__VERSION__";
2800zy(xe);
2801const sr = {
2802  // use the radius of the Normal sphere
2803  radians: 6370997 / (2 * Math.PI),
2804  degrees: 2 * Math.PI * 6370997 / 360,
2805  ft: 0.3048,
2806  m: 1,
2807  "us-ft": 1200 / 3937
2808};
2809class jy {
2810  /**
2811   * @param {Options} options Projection options.
2812   */
2813  constructor(t) {
2814    this.code_ = t.code, this.units_ = /** @type {import("./Units.js").Units} */
2815    t.units, this.extent_ = t.extent !== void 0 ? t.extent : null, this.worldExtent_ = t.worldExtent !== void 0 ? t.worldExtent : null, this.axisOrientation_ = t.axisOrientation !== void 0 ? t.axisOrientation : "enu", this.global_ = t.global !== void 0 ? t.global : !1, this.canWrapX_ = !!(this.global_ && this.extent_), this.getPointResolutionFunc_ = t.getPointResolution, this.defaultTileGrid_ = null, this.metersPerUnit_ = t.metersPerUnit;
2816  }
2817  /**
2818   * @return {boolean} The projection is suitable for wrapping the x-axis
2819   */
2820  canWrapX() {
2821    return this.canWrapX_;
2822  }
2823  /**
2824   * Get the code for this projection, e.g. 'EPSG:4326'.
2825   * @return {string} Code.
2826   * @api
2827   */
2828  getCode() {
2829    return this.code_;
2830  }
2831  /**
2832   * Get the validity extent for this projection.
2833   * @return {import("../extent.js").Extent} Extent.
2834   * @api
2835   */
2836  getExtent() {
2837    return this.extent_;
2838  }
2839  /**
2840   * Get the units of this projection.
2841   * @return {import("./Units.js").Units} Units.
2842   * @api
2843   */
2844  getUnits() {
2845    return this.units_;
2846  }
2847  /**
2848   * Get the amount of meters per unit of this projection.  If the projection is
2849   * not configured with `metersPerUnit` or a units identifier, the return is
2850   * `undefined`.
2851   * @return {number|undefined} Meters.
2852   * @api
2853   */
2854  getMetersPerUnit() {
2855    return this.metersPerUnit_ || sr[this.units_];
2856  }
2857  /**
2858   * Get the world extent for this projection.
2859   * @return {import("../extent.js").Extent} Extent.
2860   * @api
2861   */
2862  getWorldExtent() {
2863    return this.worldExtent_;
2864  }
2865  /**
2866   * Get the axis orientation of this projection.
2867   * Example values are:
2868   * enu - the default easting, northing, elevation.
2869   * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
2870   *     or south orientated transverse mercator.
2871   * wnu - westing, northing, up - some planetary coordinate systems have
2872   *     "west positive" coordinate systems
2873   * @return {string} Axis orientation.
2874   * @api
2875   */
2876  getAxisOrientation() {
2877    return this.axisOrientation_;
2878  }
2879  /**
2880   * Is this projection a global projection which spans the whole world?
2881   * @return {boolean} Whether the projection is global.
2882   * @api
2883   */
2884  isGlobal() {
2885    return this.global_;
2886  }
2887  /**
2888   * Set if the projection is a global projection which spans the whole world
2889   * @param {boolean} global Whether the projection is global.
2890   * @api
2891   */
2892  setGlobal(t) {
2893    this.global_ = t, this.canWrapX_ = !!(t && this.extent_);
2894  }
2895  /**
2896   * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
2897   */
2898  getDefaultTileGrid() {
2899    return this.defaultTileGrid_;
2900  }
2901  /**
2902   * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
2903   */
2904  setDefaultTileGrid(t) {
2905    this.defaultTileGrid_ = t;
2906  }
2907  /**
2908   * Set the validity extent for this projection.
2909   * @param {import("../extent.js").Extent} extent Extent.
2910   * @api
2911   */
2912  setExtent(t) {
2913    this.extent_ = t, this.canWrapX_ = !!(this.global_ && t);
2914  }
2915  /**
2916   * Set the world extent for this projection.
2917   * @param {import("../extent.js").Extent} worldExtent World extent
2918   *     [minlon, minlat, maxlon, maxlat].
2919   * @api
2920   */
2921  setWorldExtent(t) {
2922    this.worldExtent_ = t;
2923  }
2924  /**
2925   * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}
2926   * for this projection.
2927   * @param {function(number, import("../coordinate.js").Coordinate):number}
2927 func Function
2928   * @api
2929   */
2930  setGetPointResolution(t) {
2931    this.getPointResolutionFunc_ = t;
2932  }
2933  /**
2934   * Get the custom point resolution function for this projection (if set).
2935   * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point
2936   * resolution function (if set).
2937   */
2938  getPointResolutionFunc() {
2939    return this.getPointResolutionFunc_;
2940  }
2941}
2942const ql = jy, Sr = 6378137, Zs = Math.PI * Sr, Wy = [-Zs, -Zs, Zs, Zs], By = [-180, -85, 180, 85], Br = Sr * Math.log(Math.tan(Math.PI / 2));
2943class Ds extends ql {
2944  /**
2945   * @param {string} code Code.
2946   */
2947  constructor(t) {
2948    super({
2949      code: t,
2950      units: "m",
2951      extent: Wy,
2952      global: !0,
2953      worldExtent: By,
2954      getPointResolution: function(i, s) {
2955        return i / Math.cosh(s[1] / Sr);
2956      }
2957    });
2958  }
2959}
2960const Ac = [
2961  new Ds("EPSG:3857"),
2962  new Ds("EPSG:102100"),
2963  new Ds("EPSG:102113"),
2964  new Ds("EPSG:900913"),
2965  new Ds("http://www.opengis.net/def/crs/EPSG/0/3857"),
2966  new Ds("http://www.opengis.net/gml/srs/epsg.xml#3857")
2967];
2968function Uy(e, t, i) {
2969  const s = e.length;
2970  i = i > 1 ? i : 2, t === void 0 && (i > 2 ? t = e.slice() : t = new Array(s));
2971  for (let n = 0; n < s; n += i) {
2972    t[n] = Zs * e[n] / 180;
2973    let r = Sr * Math.log(Math.tan(Math.PI * (+e[n + 1] + 90) / 360));
2974    r > Br ? r = Br : r < -Br && (r = -Br), t[n + 1] = r;
2975  }
2976  return t;
2977}
2978function Xy(e, t, i) {
2979  const s = e.length;
2980  i = i > 1 ? i : 2, t === void 0 && (i > 2 ? t = e.slice() : t = new Array(s));
2981  for (let n = 0; n < s; n += i)
2982    t[n] = 180 * e[n] / Zs, t[n + 1] = 360 * Math.atan(Math.exp(e[n + 1] / Sr)) / Math.PI - 90;
2983  return t;
2984}
2985const $y = 6378137, Lc = [-180, -90, 180, 90], Yy = Math.PI * $y / 180;
2986class ns extends ql {
2987  /**
2988   * @param {string} code Code.
2989   * @param {string} [axisOrientation] Axis orientation.
2990   */
2991  constructor(t, i) {
2992    super({
2993      code: t,
2994      units: "degrees",
2995      extent: Lc,
2996      axisOrientation: i,
2997      global: !0,
2998      metersPerUnit: Yy,
2999      worldExtent: Lc
3000    });
3001  }
3002}
3003const Oc = [
3004  new ns("CRS:84"),
3005  new ns("EPSG:4326", "neu"),
3006  new ns("urn:ogc:def:crs:OGC:1.3:CRS84"),
3007  new ns("urn:ogc:def:crs:OGC:2:84"),
3008  new ns("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
3009  new ns("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
3010  new ns("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
3011];
3012let al = {};
3013function Ky(e) {
3014  return al[e] || al[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, "EPSG:$3")] || null;
3015}
3016function qy(e, t) {
3017  al[e] = t;
3018}
3019function Tr(e) {
3020  for (const t in e)
3021    delete e[t];
3022}
3023function _n(e) {
3024  let t;
3025  for (t in e)
3026    return !1;
3027  return !t;
3028}
3029let rn = {};
3030function mn(e, t, i) {
3031  const s = e.getCode(), n = t.getCode();
3032  s in rn || (rn[s] = {}), rn[s][n] = i;
3033}
3034function Dd(e, t) {
3035  let i;
3036  return e in rn && t in rn[e] && (i = rn[e][t]), i;
3037}
3038const Ut = {
3039  UNKNOWN: 0,
3040  INTERSECTING: 1,
3041  ABOVE: 2,
3042  RIGHT: 4,
3043  BELOW: 8,
3044  LEFT: 16
3045}, Vy = {
3046  1: "The view center is not defined",
3047  2: "The view resolution is not defined",
3048  3: "The view rotation is not defined",
3049  4: "`image` and `src` cannot be provided at the same time",
3050  5: "`imgSize` must be set when `image` is provided",
3051  7: "`format` must be set when `url` is set",
3052  8: "Unknown `serverType` configured",
3053  9: "`url` must be configured or set using `#setUrl()`",
3054  10: "The default `geometryFunction` can only handle `Point` geometries",
3055  11: "`options.featureTypes` must be an Array",
3056  12: "`options.geometryName` must also be provided when `options.bbox` is set",
3057  13: "Invalid corner",
3058  14: "Invalid color",
3059  15: "Tried to get a value for a key that does not exist in the cache",
3060  16: "Tried to set a value for a key that is used already",
3061  17: "`resolutions` must be sorted in descending order",
3062  18: "Either `origin` or `origins` must be configured, never both",
3063  19: "Number of `tileSizes` and `resolutions` must be equal",
3064  20: "Number of `origins` and `resolutions` must be equal",
3065  22: "Either `tileSize` or `tileSizes` must be configured, never both",
3066  24: "Invalid extent or geometry provided as `geometry`",
3067  25: "Cannot fit empty extent provided as `geometry`",
3068  26: "Features must have an id set",
3069  27: "Features must have an id set",
3070  28: '`renderMode` must be `"hybrid"` or `"vector"`',
3071  30: "The passed `feature` was already added to the source",
3072  31: "Tried to enqueue an `element` that was already added to the queue",
3073  32: "Transformation matrix cannot be inverted",
3074  33: "Invalid units",
3075  34: "Invalid geometry layout",
3076  36: "Unknown SRS type",
3077  37: "Unknown geometry type found",
3078  38: "`styleMapValue` has an unknown type",
3079  39: "Unknown geometry type",
3080  40: "Expected `feature` to have a geometry",
3081  41: "Expected an `ol/style/Style` or an array of `ol/style/Style.js`",
3082  42: "Question unknown, the answer is 42",
3083  43: "Expected `layers` to be an array or a `Collection`",
3084  47: "Expected `controls` to be an array or an `ol/Collection`",
3085  48: "Expected `interactions` to be an array or an `ol/Collection`",
3086  49: "Expected `overlays` to be an array or an `ol/Collection`",
3087  50: "`options.featureTypes` should be an Array",
3088  51: "Either `url` or `tileJSON` options must be provided",
3089  52: "Unknown `serverType` configured",
3090  53: "Unknown `tierSizeCalculation` configured",
3091  55: "The {-y} placeholder requires a tile grid with extent",
3092  56: "mapBrowserEvent must originate from a pointer event",
3093  57: "At least 2 conditions are required",
3094  59: "Invalid command found in the PBF",
3095  60: "Missing or invalid `size`",
3096  61: "Cannot determine IIIF Image API version from provided image information JSON",
3097  62: "A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",
3098  64: "Layer opacity must be a number",
3099  66: "`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",
3100  67: "A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",
3101  68: "A VectorTile source can only be rendered if it has a projection compatible with the view projection",
3102  69: "`width` or `height` cannot be provided together with `scale`"
3103};
3104class Hy extends Error {
3105  /**
3106   * @param {number} code Error code.
3107   */
3108  constructor(t) {
3109    const i = Vy[t];
3110    super(i), this.code = t, this.name = "AssertionError", this.message = i;
3111  }
3112}
3113const Nd = Hy;
3114function at(e, t) {
3115  if (!e)
3116    throw new Nd(t);
3117}
3118function ce(e) {
3119  const t = ve();
3120  for (let i = 0, s = e.length; i < s; ++i)
3121    qn(t, e[i]);
3122  return t;
3123}
3124function Zy(e, t, i) {
3125  const s = Math.min.apply(null, e), n = Math.min.apply(null, t), r = Math.max.apply(null, e), o = Math.max.apply(null, t);
3126  return ei(s, n, r, o, i);
3127}
3128function Ms(e, t, i) {
3129  return i ? (i[0] = e[0] - t, i[1] = e[1] - t, i[2] = e[2] + t, i[3] = e[3] + t, i) : [
3130    e[0] - t,
3131    e[1] - t,
3132    e[2] + t,
3133    e[3] + t
3134  ];
3135}
3136function Gd(e, t) {
3137  return t ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t) : e.slice();
3138}
3139function Ts(e, t, i) {
3140  let s, n;
3141  return t < e[0] ? s = e[0] - t : e[2] < t ? s = t - e[2] : s = 0, i < e[1] ? n = e[1] - i : e[3] < i ? n = i - e[3] : n = 0, s * s + n * n;
3142}
3143function Rr(e, t) {
3144  return Vl(e, t[0], t[1]);
3145}
3146function Gi(e, t) {
3147  return e[0] <= t[0] && t[2] <= e[2] && e[1] <= t[1] && t[3] <= e[3];
3148}
3149function Vl(e, t, i) {
3150  return e[0] <= t && t <= e[2] && e[1] <= i && i <= e[3];
3151}
3152function ll(e, t) {
3153  const i = e[0], s = e[1], n = e[2], r = e[3], o = t[0], a = t[1];
3154  let l = Ut.UNKNOWN;
3155  return o < i ? l = l | Ut.LEFT : o > n && (l = l | Ut.RIGHT), a < s ? l = l | Ut.BELOW : a > r && (l = l | Ut.ABOVE), l === Ut.UNKNOWN && (l = Ut.INTERSECTING), l;
3156}
3157function ve() {
3158  return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
3159}
3160function ei(e, t, i, s, n) {
3161  return n ? (n[0] = e, n[1] = t, n[2] = i, n[3] = s, n) : [e, t, i, s];
3162}
3163function Tn(e) {
3164  return ei(1 / 0, 1 / 0, -1 / 0, -1 / 0, e);
3165}
3166function go(e, t) {
3167  const i = e[0], s = e[1];
3168  return ei(i, s, i, s, t);
3169}
3170function zd(e, t, i, s, n) {
3171  const r = Tn(n);
3172  return Wd(r, e, t, i, s);
3173}
3174function pn(e, t) {
3175  return e[0] == t[0] && e[2] == t[2] && e[1] == t[1] && e[3] == t[3];
3176}
3177function jd(e, t) {
3178  return t[0] < e[0] && (e[0] = t[0]), t[2] > e[2] && (e[2] = t[2]), t[1] < e[1] && (e[1] = t[1]), t[3] > e[3] && (e[3] = t[3]), e;
3179}
3180function qn(e, t) {
3181  t[0] < e[0] && (e[0] = t[0]), t[0] > e[2] && (e[2] = t[0]), t[1] < e[1] && (e[1] = t[1]), t[1] > e[3] && (e[3] = t[1]);
3182}
3183function Wd(e, t, i, s, n) {
3184  for (; i < s; i += n)
3185    Jy(e, t[i], t[i + 1]);
3186  return e;
3187}
3188function Jy(e, t, i) {
3189  e[0] = Math.min(e[0], t), e[1] = Math.min(e[1], i), e[2] = Math.max(e[2], t), e[3] = Math.max(e[3], i);
3190}
3191function Hl(e, t) {
3192  let i;
3193  return i = t(Vo(e)), i || (i = t(Ho(e)), i) || (i = t(Zo(e)), i) || (i = t(Rs(e)), i) ? i : !1;
3194}
3195function hl(e) {
3196  let t = 0;
3197  return Is(e) || (t = mt(e) * Yt(e)), t;
3198}
3199function Vo(e) {
3200  return [e[0], e[1]];
3201}
3202function Ho(e) {
3203  return [e[2], e[1]];
3204}
3205function ii(e) {
3206  return [(e[0] + e[2]) / 2, (e[1] + e[3]) / 2];
3207}
3208function Qy(e, t) {
3209  let i;
3210  return t === "bottom-left" ? i = Vo(e) : t === "bottom-right" ? i = Ho(e) : t === "top-left" ? i = Rs(e) : t === "top-right" ? i = Zo(e) : at(!1, 13), i;
3211}
3212function on(e, t, i, s, n) {
3213  const [r, o, a, l, h, c, u, d] = cl(
3214    e,
3215    t,
3216    i,
3217    s
3218  );
3219  return ei(
3220    Math.min(r, a, h, u),
3221    Math.min(o, l, c, d),
3222    Math.max(r, a, h, u),
3223    Math.max(o, l, c, d),
3224    n
3225  );
3226}
3227function cl(e, t, i, s) {
3228  const n = t * s[0] / 2, r = t * s[1] / 2, o = Math.cos(i), a = Math.sin(i), l = n * o, h = n * a, c = r * o, u = r * a, d = e[0], f = e[1];
3229  return [
3230    d - l + u,
3231    f - h - c,
3232    d - l - u,
3233    f - h + c,
3234    d + l - u,
3235    f + h + c,
3236    d + l + u,
3237    f + h - c,
3238    d - l + u,
3239    f - h - c
3240  ];
3241}
3242function Yt(e) {
3243  return e[3] - e[1];
3244}
3245function gs(e, t, i) {
3246  const s = i || ve();
3247  return ee(e, t) ? (e[0] > t[0] ? s[0] = e[0] : s[0] = t[0], e[1] > t[1] ? s[1] = e[1] : s[1] = t[1], e[2] < t[2] ? s[2] = e[2] : s[2] = t[2], e[3] < t[3] ? s[3] = e[3] : s[3] = t[3]) : Tn(s), s;
3248}
3249function Rs(e) {
3250  return [e[0], e[3]];
3251}
3252function Zo(e) {
3253  return [e[2], e[3]];
3254}
3255function mt(e) {
3256  return e[2] - e[0];
3257}
3258function ee(e, t) {
3259  return e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1];
3260}
3261function Is(e) {
3262  return e[2] < e[0] || e[3] < e[1];
3263}
3264function t1(e, t) {
3265  return t ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t) : e;
3266}
3267function e1(e, t, i) {
3268  let s = !1;
3269  const n = ll(e, t), r = ll(e, i);
3270  if (n === Ut.INTERSECTING || r === Ut.INTERSECTING)
3271    s = !0;
3272  else {
3273    const o = e[0], a = e[1], l = e[2], h = e[3], c = t[0], u = t[1], d = i[0], f = i[1], g = (f - u) / (d - c);
3274    let _, m;
3275    r & Ut.ABOVE && !(n & Ut.ABOVE) && (_ = d - (f - h) / g, s = _ >= o && _ <= l), !s && r & Ut.RIGHT && !(n & Ut.RIGHT) && (m = f - (d - l) * g, s = m >= a && m <= h), !s && r & Ut.BELOW && !(n & Ut.BELOW) && (_ = d - (f - a) / g, s = _ >= o && _ <= l), !s && r & Ut.LEFT && !(n & Ut.LEFT) && (m = f - (d - o) * g, s = m >= a && m <= h);
3276  }
3277  return s;
3278}
3279function i1(e, t, i, s) {
3280  if (Is(e))
3281    return Tn(i);
3282  let n = [];
3283  if (s > 1) {
3284    const a = e[2] - e[0], l = e[3] - e[1];
3285    for (let h = 0; h < s; ++h)
3286      n.push(
3287        e[0] + a * h / s,
3288        e[1],
3289        e[2],
3290        e[1] + l * h / s,
3291        e[2] - a * h / s,
3292        e[3],
3293        e[0],
3294        e[3] - l * h / s
3295      );
3296  } else
3297    n = [
3298      e[0],
3299      e[1],
3300      e[2],
3301      e[1],
3302      e[2],
3303      e[3],
3304      e[0],
3305      e[3]
3306    ];
3307  t(n, n, 2);
3308  const r = [], o = [];
3309  for (let a = 0, l = n.length; a < l; a += 2)
3310    r.push(n[a]), o.push(n[a + 1]);
3311  return Zy(r, o, i);
3312}
3313function Bd(e, t) {
3314  const i = t.getExtent(), s = ii(e);
3315  if (t.canWrapX() && (s[0] < i[0] || s[0] >= i[2])) {
3316    const n = mt(i), o = Math.floor(
3317      (s[0] - i[0]) / n
3318    ) * n;
3319    e[0] -= o, e[2] -= o;
3320  }
3321  return e;
3322}
3323function s1(e, t) {
3324  if (t.canWrapX()) {
3325    const i = t.getExtent();
3326    if (!isFinite(e[0]) || !isFinite(e[2]))
3327      return [[i[0], e[1], i[2], e[3]]];
3328    Bd(e, t);
3329    const s = mt(i);
3330    if (mt(e) > s)
3331      return [[i[0], e[1], i[2], e[3]]];
3332    if (e[0] < i[0])
3333      return [
3334        [e[0] + s, e[1], i[2], e[3]],
3335        [i[0], e[1], e[2], e[3]]
3336      ];
3337    if (e[2] > i[2])
3338      return [
3339        [e[0], e[1], i[2], e[3]],
3340        [i[0], e[1], e[2] - s, e[3]]
3341      ];
3342  }
3343  return [e];
3344}
3345function Ot(e, t, i) {
3346  return Math.min(Math.max(e, t), i);
3347}
3348function n1(e, t, i, s, n, r) {
3349  const o = n - i, a = r - s;
3350  if (o !== 0 || a !== 0) {
3351    const l = ((e - i) * o + (t - s) * a) / (o * o + a * a);
3352    l > 1 ? (i = n, s = r) : l > 0 && (i += o * l, s += a * l);
3353  }
3354  return gi(e, t, i, s);
3355}
3356function gi(e, t, i, s) {
3357  const n = i - e, r = s - t;
3358  return n * n + r * r;
3359}
3360function r1(e) {
3361  const t = e.length;
3362  for (let s = 0; s < t; s++) {
3363    let n = s, r = Math.abs(e[s][s]);
3364    for (let a = s + 1; a < t; a++) {
3365      const l = Math.abs(e[a][s]);
3366      l > r && (r = l, n = a);
3367    }
3368    if (r === 0)
3369      return null;
3370    const o = e[n];
3371    e[n] = e[s], e[s] = o;
3372    for (let a = s + 1; a < t; a++) {
3373      const l = -e[a][s] / e[s][s];
3374      for (let h = s; h < t + 1; h++)
3375        s == h ? e[a][h] = 0 : e[a][h] += l * e[s][h];
3376    }
3377  }
3378  const i = new Array(t);
3379  for (let s = t - 1; s >= 0; s--) {
3380    i[s] = e[s][t] / e[s][s];
3381    for (let n = s - 1; n >= 0; n--)
3382      e[n][t] -= e[n][s] * i[s];
3383  }
3384  return i;
3385}
3386function _o(e) {
3387  return e * Math.PI / 180;
3388}
3389function $i(e, t) {
3390  const i = e % t;
3391  return i * t < 0 ? i + t : i;
3392}
3393function Se(e, t, i) {
3394  return e + i * (t - e);
3395}
3396function Ir(e, t) {
3397  const i = Math.pow(10, t);
3398  return Math.round(e * i) / i;
3399}
3400function Fc(e, t) {
3401  return Math.round(Ir(e, t));
3402}
3403function Js(e, t) {
3404  return Math.floor(Ir(e, t));
3405}
3406function zi(e, t) {
3407  return Math.ceil(Ir(e, t));
3408}
3409function Ud(e, t) {
3410  const i = ("" + e).split("."), s = ("" + t).split(".");
3411  for (let n = 0; n < Math.max(i.length, s.length); n++) {
3412    const r = parseInt(i[n] || "0", 10), o = parseInt(s[n] || "0", 10);
3413    if (r > o)
3414      return 1;
3415    if (o > r)
3416      return -1;
3417  }
3418  return 0;
3419}
3420function o1(e, t) {
3421  return e[0] += +t[0], e[1] += +t[1], e;
3422}
3423function a1(e, t) {
3424  const i = t.getRadius(), s = t.getCenter(), n = s[0], r = s[1], o = e[0], a = e[1];
3425  let l = o - n;
3426  const h = a - r;
3427  l === 0 && h === 0 && (l = 1);
3428  const c = Math.sqrt(l * l + h * h), u = n + i * l / c, d = r + i * h / c;
3429  return [u, d];
3430}
3431function Zl(e, t) {
3432  const i = e[0], s = e[1], n = t[0], r = t[1], o = n[0], a = n[1], l = r[0], h = r[1], c = l - o, u = h - a, d = c === 0 && u === 0 ? 0 : (c * (i - o) + u * (s - a)) / (c * c + u * u || 0);
3433  let f, g;
3434  return d <= 0 ? (f = o, g = a) : d >= 1 ? (f = l, g = h) : (f = o + d * c, g = a + d * u), [f, g];
3435}
3436function Fe(e, t) {
3437  let i = !0;
3438  for (let s = e.length - 1; s >= 0; --s)
3439    if (e[s] != t[s]) {
3440      i = !1;
3441      break;
3442    }
3443  return i;
3444}
3445function Jl(e, t) {
3446  const i = Math.cos(t), s = Math.sin(t), n = e[0] * i - e[1] * s, r = e[1] * i + e[0] * s;
3447  return e[0] = n, e[1] = r, e;
3448}
3449function l1(e, t) {
3450  return e[0] *= t, e[1] *= t, e;
3451}
3452function _i(e, t) {
3453  const i = e[0] - t[0], s = e[1] - t[1];
3454  return i * i + s * s;
3455}
3456function bo(e, t) {
3457  return Math.sqrt(_i(e, t));
3458}
3459function h1(e, t) {
3460  return _i(e, Zl(e, t));
3461}
3462function Xd(e, t) {
3463  if (t.canWrapX()) {
3464    const i = mt(t.getExtent()), s = $d(e, t, i);
3465    s && (e[0] -= s * i);
3466  }
3467  return e;
3468}
3469function $d(e, t, i) {
3470  const s = t.getExtent();
3471  let n = 0;
3472  return t.canWrapX() && (e[0] < s[0] || e[0] > s[2]) && (i = i || mt(s), n = Math.floor(
3473    (e[0] - s[0]) / i
3474  )), n;
3475}
3476const c1 = 63710088e-1;
3477function kc(e, t, i) {
3478  i = i || c1;
3479  const s = _o(e[1]), n = _o(t[1]), r = (n - s) / 2, o = _o(t[0] - e[0]) / 2, a = Math.sin(r) * Math.sin(r) + Math.sin(o) * Math.sin(o) * Math.cos(s) * Math.cos(n);
3480  return 2 * i * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
3481}
3482const Yd = {
3483  info: 1,
3484  warn: 2,
3485  error: 3,
3486  none: 4
3487};
3488let u1 = Yd.info;
3489function Kd(...e) {
3490  u1 > Yd.warn;
3491}
3492let ul = !0;
3493function d1(e) {
3494  ul = !(e === void 0 ? !0 : e);
3495}
3496function Ql(e, t) {
3497  if (t !== void 0) {
3498    for (let i = 0, s = e.length; i < s; ++i)
3499      t[i] = e[i];
3500    t = t;
3501  } else
3502    t = e.slice();
3503  return t;
3504}
3505function qd(e, t) {
3506  if (t !== void 0 && e !== t) {
3507    for (let i = 0, s = e.length; i < s; ++i)
3508      t[i] = e[i];
3509    e = t;
3510  }
3511  return e;
3512}
3513function Vd(e) {
3514  qy(e.getCode(), e), mn(e, e, Ql);
3515}
3516function f1(e) {
3517  e.forEach(Vd);
3518}
3519function Rt(e) {
3520  return typeof e == "string" ? Ky(
3521    /** @type {string} */
3522    e
3523  ) : (
3524    /** @type {Projection} */
3525    e || null
3526  );
3527}
3528function Dc(e, t, i, s) {
3529  e = Rt(e);
3530  let n;
3531  const r = e.getPointResolutionFunc();
3532  if (r) {
3533    if (n = r(t, i), s && s !== e.getUnits()) {
3534      const o = e.getMetersPerUnit();
3535      o && (n = n * o / sr[s]);
3536    }
3537  } else {
3538    const o = e.getUnits();
3539    if (o == "degrees" && !s || s == "degrees")
3540      n = t;
3541    else {
3542      const a = eh(
3543        e,
3544        Rt("EPSG:4326")
3545      );
3546      if (a === qd && o !== "degrees")
3547        n = t * e.getMetersPerUnit();
3548      else {
3549        let h = [
3550          i[0] - t / 2,
3551          i[1],
3552          i[0] + t / 2,
3553          i[1],
3554          i[0],
3555          i[1] - t / 2,
3556          i[0],
3557          i[1] + t / 2
3558        ];
3559        h = a(h, h, 2);
3560        const c = kc(h.slice(0, 2), h.slice(2, 4)), u = kc(h.slice(4, 6), h.slice(6, 8));
3561        n = (c + u) / 2;
3562      }
3563      const l = s ? sr[s] : e.getMetersPerUnit();
3564      l !== void 0 && (n /= l);
3565    }
3566  }
3567  return n;
3568}
3569function dl(e) {
3570  f1(e), e.forEach(function(t) {
3571    e.forEach(function(i) {
3572      t !== i && mn(t, i, Ql);
3573    });
3574  });
3575}
3576function g1(e, t, i, s) {
3577  e.forEach(function(n) {
3578    t.forEach(function(r) {
3579      mn(n, r, i), mn(r, n, s);
3580    });
3581  });
3582}
3583function th(e, t) {
3584  return e ? typeof e == "string" ? Rt(e) : (
3585    /** @type {Projection} */
3586    e
3587  ) : Rt(t);
3588}
3589function Nc(e) {
3590  return (
3591    /**
3592     * @param {Array<number>} input Input.
3593     * @param {Array<number>} [output] Output.
3594     * @param {number} [dimension] Dimension.
3595     * @return {Array<number>} Output.
3596     */
3597    function(t, i, s) {
3598      const n = t.length;
3599      s = s !== void 0 ? s : 2, i = i !== void 0 ? i : new Array(n);
3600      for (let r = 0; r < n; r += s) {
3601        const o = e(t.slice(r, r + s)), a = o.length;
3602        for (let l = 0, h = s; l < h; ++l)
3603          i[r + l] = l >= a ? t[r + l] : o[l];
3604      }
3605      return i;
3606    }
3607  );
3608}
3609function _1(e, t, i, s) {
3610  const n = Rt(e), r = Rt(t);
3611  mn(
3612    n,
3613    r,
3614    Nc(i)
3615  ), mn(
3616    r,
3617    n,
3618    Nc(s)
3619  );
3620}
3621function di(e, t) {
3622  if (e === t)
3623    return !0;
3624  const i = e.getUnits() === t.getUnits();
3625  return (e.getCode() === t.getCode() || eh(e, t) === Ql) && i;
3626}
3627function eh(e, t) {
3628  const i = e.getCode(), s = t.getCode();
3629  let n = Dd(i, s);
3630  return n || (n = qd), n;
3631}
3632function nr(e, t) {
3633  const i = Rt(e), s = Rt(t);
3634  return eh(i, s);
3635}
3636function Jo(e, t, i) {
3637  return nr(t, i)(e, void 0, e.length);
3638}
3639function m1(e, t, i, s) {
3640  const n = nr(t, i);
3641  return i1(e, n, void 0, s);
3642}
3643function Cs(e, t) {
3644  return e;
3645}
3646function Pt(e, t) {
3647  return ul && !Fe(e, [0, 0]) && e[0] >= -180 && e[0] <= 180 && e[1] >= -90 && e[1] <= 90 && (ul = !1, Kd(
3648    "Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates."
3649  )), e;
3650}
3651function Qo(e, t) {
3652  return e;
3653}
3654function He(e, t) {
3655  return e;
3656}
3657function Gc(e, t, i) {
3658  return function(s) {
3659    let n, r;
3660    if (e.canWrapX()) {
3661      const o = e.getExtent(), a = mt(o);
3662      s = s.slice(0), r = $d(s, e, a), r && (s[0] = s[0] - r * a), s[0] = Ot(s[0], o[0], o[2]), s[1] = Ot(s[1], o[1], o[3]), n = i(s);
3663    } else
3664      n = i(s);
3665    return r && t.canWrapX() && (n[0] += r * mt(t.getExtent())), n;
3666  };
3667}
3668function p1() {
3669  dl(Ac), dl(Oc), g1(
3670    Oc,
3671    Ac,
3672    Uy,
3673    Xy
3674  );
3675}
3676p1();
3677let y1 = null;
3678function x1(e) {
3679  y1 = e;
3680  const t = Object.keys(e.defs), i = t.length;
3681  let s, n;
3682  for (s = 0; s < i; ++s) {
3683    const r = t[s];
3684    if (!Rt(r)) {
3685      const o = e.defs(r);
3686      let a = (
3687        /** @type {import("./Units.js").Units} */
3688        o.units
3689      );
3690      !a && o.projName === "longlat" && (a = "degrees"), Vd(
3691        new ql({
3692          code: r,
3693          axisOrientation: o.axis,
3694          metersPerUnit: o.to_meter,
3695          units: a
3696        })
3697      );
3698    }
3699  }
3700  for (s = 0; s < i; ++s) {
3701    const r = t[s], o = Rt(r);
3702    for (n = 0; n < i; ++n) {
3703      const a = t[n], l = Rt(a);
3704      if (!Dd(r, a))
3705        if (e.defs[r] === e.defs[a])
3706          dl([o, l]);
3707        else {
3708          const h = e(r, a);
3709          _1(
3710            o,
3711            l,
3712            Gc(o, l, h.forward),
3713            Gc(l, o, h.inverse)
3714          );
3715        }
3716    }
3717  }
3718}
3719function ih(e, t) {
3720  const i = /* @__PURE__ */ Object.create(null), s = e.split(",");
3721  for (let n = 0; n < s.length; n++)
3722    i[s[n]] = !0;
3723  return t ? (n) => !!i[n.toLowerCase()] : (n) => !!i[n];
3724}
3725const At = {}, an = [], je = () => {
3726}, v1 = () => !1, E1 = /^on[^a-z]/, ta = (e) => E1.test(e), sh = (e) => e.startsWith("onUpdate:"), jt = Object.assign, nh = (e, t) => {
3727  const i = e.indexOf(t);
3728  i > -1 && e.splice(i, 1);
3729}, M1 = Object.prototype.hasOwnProperty, _t = (e, t) => M1.call(e, t), it = Array.isArray, ln = (e) => ea(e) === "[object Map]", Hd = (e) => ea(e) === "[object Set]", ht = (e) => typeof e == "function", Wt = (e) => typeof e == "string", rh = (e) => typeof e == "symbol", Ft = (e) => e !== null && typeof e == "object", Zd = (e) => Ft(e) && ht(e.then) && ht(e.catch), Jd = Object.prototype.toString, ea = (e) =>
vendor: 82,342 bytes, lines 3729-7068
3729 Jd.call(e), C1 = (e) => ea(e).slice(8, -1), Qd = (e) => ea(e) === "[object Object]", oh = (e) => Wt(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, mo = /* @__PURE__ */ ih(
3730  // the leading comma is intentional so empty string "" is also included
3731  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
3732), ia = (e) => {
3733  const t = /* @__PURE__ */ Object.create(null);
3734  return (i) => t[i] || (t[i] = e(i));
3735}, b1 = /-(\w)/g, mi = ia((e) => e.replace(b1, (t, i) => i ? i.toUpperCase() : "")), w1 = /\B([A-Z])/g, De = ia(
3736  (e) => e.replace(w1, "-$1").toLowerCase()
3737), tf = ia(
3738  (e) => e.charAt(0).toUpperCase() + e.slice(1)
3739), Sa = ia(
3740  (e) => e ? `on${tf(e)}` : ""
3741), wo = (e, t) => !Object.is(e, t), Ta = (e, t) => {
3742  for (let i = 0; i < e.length; i++)
3743    e[i](t);
3744}, So = (e, t, i) => {
3745  Object.defineProperty(e, t, {
3746    configurable: !0,
3747    enumerable: !1,
3748    value: i
3749  });
3750}, S1 = (e) => {
3751  const t = parseFloat(e);
3752  return isNaN(t) ? e : t;
3753}, zc = (e) => {
3754  const t = Wt(e) ? Number(e) : NaN;
3755  return isNaN(t) ? e : t;
3756};
3757let jc;
3758const fl = () => jc || (jc = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
3759function Pr(e) {
3760  if (it(e)) {
3761    const t = {};
3762    for (let i = 0; i < e.length; i++) {
3763      const s = e[i], n = Wt(s) ? P1(s) : Pr(s);
3764      if (n)
3765        for (const r in n)
3766          t[r] = n[r];
3767    }
3768    return t;
3769  } else {
3770    if (Wt(e))
3771      return e;
3772    if (Ft(e))
3773      return e;
3774  }
3775}
3776const T1 = /;(?![^(]*\))/g, R1 = /:([^]+)/, I1 = /\/\*[^]*?\*\//g;
3777function P1(e) {
3778  const t = {};
3779  return e.replace(I1, "").split(T1).forEach((i) => {
3780    if (i) {
3781      const s = i.split(R1);
3782      s.length > 1 && (t[s[0].trim()] = s[1].trim());
3783    }
3784  }), t;
3785}
3786function bs(e) {
3787  let t = "";
3788  if (Wt(e))
3789    t = e;
3790  else if (it(e))
3791    for (let i = 0; i < e.length; i++) {
3792      const s = bs(e[i]);
3793      s && (t += s + " ");
3794    }
3795  else if (Ft(e))
3796    for (const i in e)
3797      e[i] && (t += i + " ");
3798  return t.trim();
3799}
3800const A1 = "itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly", L1 = /* @__PURE__ */ ih(A1);
3801function ef(e) {
3802  return !!e || e === "";
3803}
3804const fi = (e) => Wt(e) ? e : e == null ? "" : it(e) || Ft(e) && (e.toString === Jd || !ht(e.toString)) ? JSON.stringify(e, sf, 2) : String(e), sf = (e, t) => t && t.__v_isRef ? sf(e, t.value) : ln(t) ? {
3805  [`Map(${t.size})`]: [...t.entries()].reduce((i, [s, n]) => (i[`${s} =>`] = n, i), {})
3806} : Hd(t) ? {
3807  [`Set(${t.size})`]: [...t.values()]
3808} : Ft(t) && !it(t) && !Qd(t) ? String(t) : t;
3809let Oe;
3810class O1 {
3811  constructor(t = !1) {
3812    this.detached = t, this._active = !0, this.effects = [], this.cleanups = [], this.parent = Oe, !t && Oe && (this.index = (Oe.scopes || (Oe.scopes = [])).push(
3813      this
3814    ) - 1);
3815  }
3816  get active() {
3817    return this._active;
3818  }
3819  run(t) {
3820    if (this._active) {
3821      const i = Oe;
3822      try {
3823        return Oe = this, t();
3824      } finally {
3825        Oe = i;
3826      }
3827    }
3828  }
3829  /**
3830   * This should only be called on non-detached scopes
3831   * @internal
3832   */
3833  on() {
3834    Oe = this;
3835  }
3836  /**
3837   * This should only be called on non-detached scopes
3838   * @internal
3839   */
3840  off() {
3841    Oe = this.parent;
3842  }
3843  stop(t) {
3844    if (this._active) {
3845      let i, s;
3846      for (i = 0, s = this.effects.length; i < s; i++)
3847        this.effects[i].stop();
3848      for (i = 0, s = this.cleanups.length; i < s; i++)
3849        this.cleanups[i]();
3850      if (this.scopes)
3851        for (i = 0, s = this.scopes.length; i < s; i++)
3852          this.scopes[i].stop(!0);
3853      if (!this.detached && this.parent && !t) {
3854        const n = this.parent.scopes.pop();
3855        n && n !== this && (this.parent.scopes[this.index] = n, n.index = this.index);
3856      }
3857      this.parent = void 0, this._active = !1;
3858    }
3859  }
3860}
3861function F1(e, t = Oe) {
3862  t && t.active && t.effects.push(e);
3863}
3864function k1() {
3865  return Oe;
3866}
3867const ah = (e) => {
3868  const t = new Set(e);
3869  return t.w = 0, t.n = 0, t;
3870}, nf = (e) => (e.w & Ji) > 0, rf = (e) => (e.n & Ji) > 0, D1 = ({ deps: e }) => {
3871  if (e.length)
3872    for (let t = 0; t < e.length; t++)
3873      e[t].w |= Ji;
3874}, N1 = (e) => {
3875  const { deps: t } = e;
3876  if (t.length) {
3877    let i = 0;
3878    for (let s = 0; s < t.length; s++) {
3879      const n = t[s];
3880      nf(n) && !rf(n) ? n.delete(e) : t[i++] = n, n.w &= ~Ji, n.n &= ~Ji;
3881    }
3882    t.length = i;
3883  }
3884}, gl = /* @__PURE__ */ new WeakMap();
3885let Un = 0, Ji = 1;
3886const _l = 30;
3887let Ne;
3888const _s = Symbol(""), ml = Symbol("");
3889class lh {
3890  constructor(t, i = null, s) {
3891    this.fn = t, this.scheduler = i, this.active = !0, this.deps = [], this.parent = void 0, F1(this, s);
3892  }
3893  run() {
3894    if (!this.active)
3895      return this.fn();
3896    let t = Ne, i = Yi;
3897    for (; t; ) {
3898      if (t === this)
3899        return;
3900      t = t.parent;
3901    }
3902    try {
3903      return this.parent = Ne, Ne = this, Yi = !0, Ji = 1 << ++Un, Un <= _l ? D1(this) : Wc(this), this.fn();
3904    } finally {
3905      Un <= _l && N1(this), Ji = 1 << --Un, Ne = this.parent, Yi = i, this.parent = void 0, this.deferStop && this.stop();
3906    }
3907  }
3908  stop() {
3909    Ne === this ? this.deferStop = !0 : this.active && (Wc(this), this.onStop && this.onStop(), this.active = !1);
3910  }
3911}
3912function Wc(e) {
3913  const { deps: t } = e;
3914  if (t.length) {
3915    for (let i = 0; i < t.length; i++)
3916      t[i].delete(e);
3917    t.length = 0;
3918  }
3919}
3920let Yi = !0;
3921const of = [];
3922function Rn() {
3923  of.push(Yi), Yi = !1;
3924}
3925function In() {
3926  const e = of.pop();
3927  Yi = e === void 0 ? !0 : e;
3928}
3929function Ee(e, t, i) {
3930  if (Yi && Ne) {
3931    let s = gl.get(e);
3932    s || gl.set(e, s = /* @__PURE__ */ new Map());
3933    let n = s.get(i);
3934    n || s.set(i, n = ah()), af(n);
3935  }
3936}
3937function af(e, t) {
3938  let i = !1;
3939  Un <= _l ? rf(e) || (e.n |= Ji, i = !nf(e)) : i = !e.has(Ne), i && (e.add(Ne), Ne.deps.push(e));
3940}
3941function Ei(e, t, i, s, n, r) {
3942  const o = gl.get(e);
3943  if (!o)
3944    return;
3945  let a = [];
3946  if (t === "clear")
3947    a = [...o.values()];
3948  else if (i === "length" && it(e)) {
3949    const l = Number(s);
3950    o.forEach((h, c) => {
3951      (c === "length" || c >= l) && a.push(h);
3952    });
3953  } else
3954    switch (i !== void 0 && a.push(o.get(i)), t) {
3955      case "add":
3956        it(e) ? oh(i) && a.push(o.get("length")) : (a.push(o.get(_s)), ln(e) && a.push(o.get(ml)));
3957        break;
3958      case "delete":
3959        it(e) || (a.push(o.get(_s)), ln(e) && a.push(o.get(ml)));
3960        break;
3961      case "set":
3962        ln(e) && a.push(o.get(_s));
3963        break;
3964    }
3965  if (a.length === 1)
3966    a[0] && pl(a[0]);
3967  else {
3968    const l = [];
3969    for (const h of a)
3970      h && l.push(...h);
3971    pl(ah(l));
3972  }
3973}
3974function pl(e, t) {
3975  const i = it(e) ? e : [...e];
3976  for (const s of i)
3977    s.computed && Bc(s);
3978  for (const s of i)
3979    s.computed || Bc(s);
3980}
3981function Bc(e, t) {
3982  (e !== Ne || e.allowRecurse) && (e.scheduler ? e.scheduler() : e.run());
3983}
3984const G1 = /* @__PURE__ */ ih("__proto__,__v_isRef,__isVue"), lf = new Set(
3985  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(rh)
3986), z1 = /* @__PURE__ */ hh(), j1 = /* @__PURE__ */ hh(!1, !0), W1 = /* @__PURE__ */ hh(!0), Uc = /* @__PURE__ */ B1();
3987function B1() {
3988  const e = {};
3989  return ["includes", "indexOf", "lastIndexOf"].forEach((t) => {
3990    e[t] = function(...i) {
3991      const s = Ct(this);
3992      for (let r = 0, o = this.length; r < o; r++)
3993        Ee(s, "get", r + "");
3994      const n = s[t](...i);
3995      return n === -1 || n === !1 ? s[t](...i.map(Ct)) : n;
3996    };
3997  }), ["push", "pop", "shift", "unshift", "splice"].forEach((t) => {
3998    e[t] = function(...i) {
3999      Rn();
4000      const s = Ct(this)[t].apply(this, i);
4001      return In(), s;
4002    };
4003  }), e;
4004}
4005function U1(e) {
4006  const t = Ct(this);
4007  return Ee(t, "has", e), t.hasOwnProperty(e);
4008}
4009function hh(e = !1, t = !1) {
4010  return function(s, n, r) {
4011    if (n === "__v_isReactive")
4012      return !e;
4013    if (n === "__v_isReadonly")
4014      return e;
4015    if (n === "__v_isShallow")
4016      return t;
4017    if (n === "__v_raw" && r === (e ? t ? rx : ff : t ? df : uf).get(s))
4018      return s;
4019    const o = it(s);
4020    if (!e) {
4021      if (o && _t(Uc, n))
4022        return Reflect.get(Uc, n, r);
4023      if (n === "hasOwnProperty")
4024        return U1;
4025    }
4026    const a = Reflect.get(s, n, r);
4027    return (rh(n) ? lf.has(n) : G1(n)) || (e || Ee(s, "get", n), t) ? a : de(a) ? o && oh(n) ? a : a.value : Ft(a) ? e ? gf(a) : na(a) : a;
4028  };
4029}
4030const X1 = /* @__PURE__ */ hf(), $1 = /* @__PURE__ */ hf(!0);
4031function hf(e = !1) {
4032  return function(i, s, n, r) {
4033    let o = i[s];
4034    if (rr(o) && de(o) && !de(n))
4035      return !1;
4036    if (!e && (!yl(n) && !rr(n) && (o = Ct(o), n = Ct(n)), !it(i) && de(o) && !de(n)))
4037      return o.value = n, !0;
4038    const a = it(i) && oh(s) ? Number(s) < i.length : _t(i, s), l = Reflect.set(i, s, n, r);
4039    return i === Ct(r) && (a ? wo(n, o) && Ei(i, "set", s, n) : Ei(i, "add", s, n)), l;
4040  };
4041}
4042function Y1(e, t) {
4043  const i = _t(e, t);
4044  e[t];
4045  const s = Reflect.deleteProperty(e, t);
4046  return s && i && Ei(e, "delete", t, void 0), s;
4047}
4048function K1(e, t) {
4049  const i = Reflect.has(e, t);
4050  return (!rh(t) || !lf.has(t)) && Ee(e, "has", t), i;
4051}
4052function q1(e) {
4053  return Ee(e, "iterate", it(e) ? "length" : _s), Reflect.ownKeys(e);
4054}
4055const cf = {
4056  get: z1,
4057  set: X1,
4058  deleteProperty: Y1,
4059  has: K1,
4060  ownKeys: q1
4061}, V1 = {
4062  get: W1,
4063  set(e, t) {
4064    return !0;
4065  },
4066  deleteProperty(e, t) {
4067    return !0;
4068  }
4069}, H1 = /* @__PURE__ */ jt(
4070  {},
4071  cf,
4072  {
4073    get: j1,
4074    set: $1
4075  }
4076), ch = (e) => e, sa = (e) => Reflect.getPrototypeOf(e);
4077function Ur(e, t, i = !1, s = !1) {
4078  e = e.__v_raw;
4079  const n = Ct(e), r = Ct(t);
4080  i || (t !== r && Ee(n, "get", t), Ee(n, "get", r));
4081  const { has: o } = sa(n), a = s ? ch : i ? gh : fh;
4082  if (o.call(n, t))
4083    return a(e.get(t));
4084  if (o.call(n, r))
4085    return a(e.get(r));
4086  e !== n && e.get(t);
4087}
4088function Xr(e, t = !1) {
4089  const i = this.__v_raw, s = Ct(i), n = Ct(e);
4090  return t || (e !== n && Ee(s, "has", e), Ee(s, "has", n)), e === n ? i.has(e) : i.has(e) || i.has(n);
4091}
4092function $r(e, t = !1) {
4093  return e = e.__v_raw, !t && Ee(Ct(e), "iterate", _s), Reflect.get(e, "size", e);
4094}
4095function Xc(e) {
4096  e = Ct(e);
4097  const t = Ct(this);
4098  return sa(t).has.call(t, e) || (t.add(e), Ei(t, "add", e, e)), this;
4099}
4100function $c(e, t) {
4101  t = Ct(t);
4102  const i = Ct(this), { has: s, get: n } = sa(i);
4103  let r = s.call(i, e);
4104  r || (e = Ct(e), r = s.call(i, e));
4105  const o = n.call(i, e);
4106  return i.set(e, t), r ? wo(t, o) && Ei(i, "set", e, t) : Ei(i, "add", e, t), this;
4107}
4108function Yc(e) {
4109  const t = Ct(this), { has: i, get: s } = sa(t);
4110  let n = i.call(t, e);
4111  n || (e = Ct(e), n = i.call(t, e)), s && s.call(t, e);
4112  const r = t.delete(e);
4113  return n && Ei(t, "delete", e, void 0), r;
4114}
4115function Kc() {
4116  const e = Ct(this), t = e.size !== 0, i = e.clear();
4117  return t && Ei(e, "clear", void 0, void 0), i;
4118}
4119function Yr(e, t) {
4120  return function(s, n) {
4121    const r = this, o = r.__v_raw, a = Ct(o), l = t ? ch : e ? gh : fh;
4122    return !e && Ee(a, "iterate", _s), o.forEach((h, c) => s.call(n, l(h), l(c), r));
4123  };
4124}
4125function Kr(e, t, i) {
4126  return function(...s) {
4127    const n = this.__v_raw, r = Ct(n), o = ln(r), a = e === "entries" || e === Symbol.iterator && o, l = e === "keys" && o, h = n[e](...s), c = i ? ch : t ? gh : fh;
4128    return !t && Ee(
4129      r,
4130      "iterate",
4131      l ? ml : _s
4132    ), {
4133      // iterator protocol
4134      next() {
4135        const { value: u, done: d } = h.next();
4136        return d ? { value: u, done: d } : {
4137          value: a ? [c(u[0]), c(u[1])] : c(u),
4138          done: d
4139        };
4140      },
4141      // iterable protocol
4142      [Symbol.iterator]() {
4143        return this;
4144      }
4145    };
4146  };
4147}
4148function Ti(e) {
4149  return function(...t) {
4150    return e === "delete" ? !1 : this;
4151  };
4152}
4153function Z1() {
4154  const e = {
4155    get(r) {
4156      return Ur(this, r);
4157    },
4158    get size() {
4159      return $r(this);
4160    },
4161    has: Xr,
4162    add: Xc,
4163    set: $c,
4164    delete: Yc,
4165    clear: Kc,
4166    forEach: Yr(!1, !1)
4167  }, t = {
4168    get(r) {
4169      return Ur(this, r, !1, !0);
4170    },
4171    get size() {
4172      return $r(this);
4173    },
4174    has: Xr,
4175    add: Xc,
4176    set: $c,
4177    delete: Yc,
4178    clear: Kc,
4179    forEach: Yr(!1, !0)
4180  }, i = {
4181    get(r) {
4182      return Ur(this, r, !0);
4183    },
4184    get size() {
4185      return $r(this, !0);
4186    },
4187    has(r) {
4188      return Xr.call(this, r, !0);
4189    },
4190    add: Ti("add"),
4191    set: Ti("set"),
4192    delete: Ti("delete"),
4193    clear: Ti("clear"),
4194    forEach: Yr(!0, !1)
4195  }, s = {
4196    get(r) {
4197      return Ur(this, r, !0, !0);
4198    },
4199    get size() {
4200      return $r(this, !0);
4201    },
4202    has(r) {
4203      return Xr.call(this, r, !0);
4204    },
4205    add: Ti("add"),
4206    set: Ti("set"),
4207    delete: Ti("delete"),
4208    clear: Ti("clear"),
4209    forEach: Yr(!0, !0)
4210  };
4211  return ["keys", "values", "entries", Symbol.iterator].forEach((r) => {
4212    e[r] = Kr(
4213      r,
4214      !1,
4215      !1
4216    ), i[r] = Kr(
4217      r,
4218      !0,
4219      !1
4220    ), t[r] = Kr(
4221      r,
4222      !1,
4223      !0
4224    ), s[r] = Kr(
4225      r,
4226      !0,
4227      !0
4228    );
4229  }), [
4230    e,
4231    i,
4232    t,
4233    s
4234  ];
4235}
4236const [
4237  J1,
4238  Q1,
4239  tx,
4240  ex
4241] = /* @__PURE__ */ Z1();
4242function uh(e, t) {
4243  const i = t ? e ? ex : tx : e ? Q1 : J1;
4244  return (s, n, r) => n === "__v_isReactive" ? !e : n === "__v_isReadonly" ? e : n === "__v_raw" ? s : Reflect.get(
4245    _t(i, n) && n in s ? i : s,
4246    n,
4247    r
4248  );
4249}
4250const ix = {
4251  get: /* @__PURE__ */ uh(!1, !1)
4252}, sx = {
4253  get: /* @__PURE__ */ uh(!1, !0)
4254}, nx = {
4255  get: /* @__PURE__ */ uh(!0, !1)
4256}, uf = /* @__PURE__ */ new WeakMap(), df = /* @__PURE__ */ new WeakMap(), ff = /* @__PURE__ */ new WeakMap(), rx = /* @__PURE__ */ new WeakMap();
4257function ox(e) {
4258  switch (e) {
4259    case "Object":
4260    case "Array":
4261      return 1;
4262    case "Map":
4263    case "Set":
4264    case "WeakMap":
4265    case "WeakSet":
4266      return 2;
4267    default:
4268      return 0;
4269  }
4270}
4271function ax(e) {
4272  return e.__v_skip || !Object.isExtensible(e) ? 0 : ox(C1(e));
4273}
4274function na(e) {
4275  return rr(e) ? e : dh(
4276    e,
4277    !1,
4278    cf,
4279    ix,
4280    uf
4281  );
4282}
4283function lx(e) {
4284  return dh(
4285    e,
4286    !1,
4287    H1,
4288    sx,
4289    df
4290  );
4291}
4292function gf(e) {
4293  return dh(
4294    e,
4295    !0,
4296    V1,
4297    nx,
4298    ff
4299  );
4300}
4301function dh(e, t, i, s, n) {
4302  if (!Ft(e) || e.__v_raw && !(t && e.__v_isReactive))
4303    return e;
4304  const r = n.get(e);
4305  if (r)
4306    return r;
4307  const o = ax(e);
4308  if (o === 0)
4309    return e;
4310  const a = new Proxy(
4311    e,
4312    o === 2 ? s : i
4313  );
4314  return n.set(e, a), a;
4315}
4316function hn(e) {
4317  return rr(e) ? hn(e.__v_raw) : !!(e && e.__v_isReactive);
4318}
4319function rr(e) {
4320  return !!(e && e.__v_isReadonly);
4321}
4322function yl(e) {
4323  return !!(e && e.__v_isShallow);
4324}
4325function _f(e) {
4326  return hn(e) || rr(e);
4327}
4328function Ct(e) {
4329  const t = e && e.__v_raw;
4330  return t ? Ct(t) : e;
4331}
4332function yn(e) {
4333  return So(e, "__v_skip", !0), e;
4334}
4335const fh = (e) => Ft(e) ? na(e) : e, gh = (e) => Ft(e) ? gf(e) : e;
4336function hx(e) {
4337  Yi && Ne && (e = Ct(e), af(e.dep || (e.dep = ah())));
4338}
4339function cx(e, t) {
4340  e = Ct(e);
4341  const i = e.dep;
4342  i && pl(i);
4343}
4344function de(e) {
4345  return !!(e && e.__v_isRef === !0);
4346}
4347function ux(e) {
4348  return de(e) ? e.value : e;
4349}
4350const dx = {
4351  get: (e, t, i) => ux(Reflect.get(e, t, i)),
4352  set: (e, t, i, s) => {
4353    const n = e[t];
4354    return de(n) && !de(i) ? (n.value = i, !0) : Reflect.set(e, t, i, s);
4355  }
4356};
4357function mf(e) {
4358  return hn(e) ? e : new Proxy(e, dx);
4359}
4360class fx {
4361  constructor(t, i, s, n) {
4362    this._setter = i, this.dep = void 0, this.__v_isRef = !0, this.__v_isReadonly = !1, this._dirty = !0, this.effect = new lh(t, () => {
4363      this._dirty || (this._dirty = !0, cx(this));
4364    }), this.effect.computed = this, this.effect.active = this._cacheable = !n, this.__v_isReadonly = s;
4365  }
4366  get value() {
4367    const t = Ct(this);
4368    return hx(t), (t._dirty || !t._cacheable) && (t._dirty = !1, t._value = t.effect.run()), t._value;
4369  }
4370  set value(t) {
4371    this._setter(t);
4372  }
4373}
4374function gx(e, t, i = !1) {
4375  let s, n;
4376  const r = ht(e);
4377  return r ? (s = e, n = je) : (s = e.get, n = e.set), new fx(s, n, r || !n, i);
4378}
4379function Ki(e, t, i, s) {
4380  let n;
4381  try {
4382    n = s ? e(...s) : e();
4383  } catch (r) {
4384    ra(r, t, i);
4385  }
4386  return n;
4387}
4388function We(e, t, i, s) {
4389  if (ht(e)) {
4390    const r = Ki(e, t, i, s);
4391    return r && Zd(r) && r.catch((o) => {
4392      ra(o, t, i);
4393    }), r;
4394  }
4395  const n = [];
4396  for (let r = 0; r < e.length; r++)
4397    n.push(We(e[r], t, i, s));
4398  return n;
4399}
4400function ra(e, t, i, s = !0) {
4401  const n = t ? t.vnode : null;
4402  if (t) {
4403    let r = t.parent;
4404    const o = t.proxy, a = i;
4405    for (; r; ) {
4406      const h = r.ec;
4407      if (h) {
4408        for (let c = 0; c < h.length; c++)
4409          if (h[c](e, o, a) === !1)
4410            return;
4411      }
4412      r = r.parent;
4413    }
4414    const l = t.appContext.config.errorHandler;
4415    if (l) {
4416      Ki(
4417        l,
4418        null,
4419        10,
4420        [e, o, a]
4421      );
4422      return;
4423    }
4424  }
4425}
4426let or = !1, xl = !1;
4427const ie = [];
4428let Ke = 0;
4429const cn = [];
4430let ci = null, hs = 0;
4431const pf = /* @__PURE__ */ Promise.resolve();
4432let _h = null;
4433function yf(e) {
4434  const t = _h || pf;
4435  return e ? t.then(this ? e.bind(this) : e) : t;
4436}
4437function _x(e) {
4438  let t = Ke + 1, i = ie.length;
4439  for (; t < i; ) {
4440    const s = t + i >>> 1;
4441    ar(ie[s]) < e ? t = s + 1 : i = s;
4442  }
4443  return t;
4444}
4445function mh(e) {
4446  (!ie.length || !ie.includes(
4447    e,
4448    or && e.allowRecurse ? Ke + 1 : Ke
4449  )) && (e.id == null ? ie.push(e) : ie.splice(_x(e.id), 0, e), xf());
4450}
4451function xf() {
4452  !or && !xl && (xl = !0, _h = pf.then(Ef));
4453}
4454function mx(e) {
4455  const t = ie.indexOf(e);
4456  t > Ke && ie.splice(t, 1);
4457}
4458function px(e) {
4459  it(e) ? cn.push(...e) : (!ci || !ci.includes(
4460    e,
4461    e.allowRecurse ? hs + 1 : hs
4462  )) && cn.push(e), xf();
4463}
4464function qc(e, t = or ? Ke + 1 : 0) {
4465  for (; t < ie.length; t++) {
4466    const i = ie[t];
4467    i && i.pre && (ie.splice(t, 1), t--, i());
4468  }
4469}
4470function vf(e) {
4471  if (cn.length) {
4472    const t = [...new Set(cn)];
4473    if (cn.length = 0, ci) {
4474      ci.push(...t);
4475      return;
4476    }
4477    for (ci = t, ci.sort((i, s) => ar(i) - ar(s)), hs = 0; hs < ci.length; hs++)
4478      ci[hs]();
4479    ci = null, hs = 0;
4480  }
4481}
4482const ar = (e) => e.id == null ? 1 / 0 : e.id, yx = (e, t) => {
4483  const i = ar(e) - ar(t);
4484  if (i === 0) {
4485    if (e.pre && !t.pre)
4486      return -1;
4487    if (t.pre && !e.pre)
4488      return 1;
4489  }
4490  return i;
4491};
4492function Ef(e) {
4493  xl = !1, or = !0, ie.sort(yx);
4494  const t = je;
4495  try {
4496    for (Ke = 0; Ke < ie.length; Ke++) {
4497      const i = ie[Ke];
4498      i && i.active !== !1 && Ki(i, null, 14);
4499    }
4500  } finally {
4501    Ke = 0, ie.length = 0, vf(), or = !1, _h = null, (ie.length || cn.length) && Ef();
4502  }
4503}
4504function xx(e, t, ...i) {
4505  if (e.isUnmounted)
4506    return;
4507  const s = e.vnode.props || At;
4508  let n = i;
4509  const r = t.startsWith("update:"), o = r && t.slice(7);
4510  if (o && o in s) {
4511    const c = `${o === "modelValue" ? "model" : o}Modifiers`, { number: u, trim: d } = s[c] || At;
4512    d && (n = i.map((f) => Wt(f) ? f.trim() : f)), u && (n = i.map(S1));
4513  }
4514  let a, l = s[a = Sa(t)] || // also try camelCase event handler (#2249)
4515  s[a = Sa(mi(t))];
4516  !l && r && (l = s[a = Sa(De(t))]), l && We(
4517    l,
4518    e,
4519    6,
4520    n
4521  );
4522  const h = s[a + "Once"];
4523  if (h) {
4524    if (!e.emitted)
4525      e.emitted = {};
4526    else if (e.emitted[a])
4527      return;
4528    e.emitted[a] = !0, We(
4529      h,
4530      e,
4531      6,
4532      n
4533    );
4534  }
4535}
4536function Mf(e, t, i = !1) {
4537  const s = t.emitsCache, n = s.get(e);
4538  if (n !== void 0)
4539    return n;
4540  const r = e.emits;
4541  let o = {}, a = !1;
4542  if (!ht(e)) {
4543    const l = (h) => {
4544      const c = Mf(h, t, !0);
4545      c && (a = !0, jt(o, c));
4546    };
4547    !i && t.mixins.length && t.mixins.forEach(l), e.extends && l(e.extends), e.mixins && e.mixins.forEach(l);
4548  }
4549  return !r && !a ? (Ft(e) && s.set(e, null), null) : (it(r) ? r.forEach((l) => o[l] = null) : jt(o, r), Ft(e) && s.set(e, o), o);
4550}
4551function oa(e, t) {
4552  return !e || !ta(t) ? !1 : (t = t.slice(2).replace(/Once$/, ""), _t(e, t[0].toLowerCase() + t.slice(1)) || _t(e, De(t)) || _t(e, t));
4553}
4554let pe = null, Cf = null;
4555function To(e) {
4556  const t = pe;
4557  return pe = e, Cf = e && e.type.__scopeId || null, t;
4558}
4559function vx(e, t = pe, i) {
4560  if (!t || e._n)
4561    return e;
4562  const s = (...n) => {
4563    s._d && nu(-1);
4564    const r = To(t);
4565    let o;
4566    try {
4567      o = e(...n);
4568    } finally {
4569      To(r), s._d && nu(1);
4570    }
4571    return o;
4572  };
4573  return s._n = !0, s._c = !0, s._d = !0, s;
4574}
4575function Ra(e) {
4576  const {
4577    type: t,
4578    vnode: i,
4579    proxy: s,
4580    withProxy: n,
4581    props: r,
4582    propsOptions: [o],
4583    slots: a,
4584    attrs: l,
4585    emit: h,
4586    render: c,
4587    renderCache: u,
4588    data: d,
4589    setupState: f,
4590    ctx: g,
4591    inheritAttrs: _
4592  } = e;
4593  let m, p;
4594  const y = To(e);
4595  try {
4596    if (i.shapeFlag & 4) {
4597      const E = n || s;
4598      m = Ye(
4599        c.call(
4600          E,
4601          E,
4602          u,
4603          r,
4604          f,
4605          d,
4606          g
4607        )
4608      ), p = l;
4609    } else {
4610      const E = t;
4611      m = Ye(
4612        E.length > 1 ? E(
4613          r,
4614          { attrs: l, slots: a, emit: h }
4615        ) : E(
4616          r,
4617          null
4618          /* we know it doesn't need it */
4619        )
4620      ), p = t.props ? l : Ex(l);
4621    }
4622  } catch (E) {
4623    Zn.length = 0, ra(E, e, 1), m = Be(Qi);
4624  }
4625  let v = m;
4626  if (p && _ !== !1) {
4627    const E = Object.keys(p), { shapeFlag: C } = v;
4628    E.length && C & 7 && (o && E.some(sh) && (p = Mx(
4629      p,
4630      o
4631    )), v = xn(v, p));
4632  }
4633  return i.dirs && (v = xn(v), v.dirs = v.dirs ? v.dirs.concat(i.dirs) : i.dirs), i.transition && (v.transition = i.transition), m = v, To(y), m;
4634}
4635const Ex = (e) => {
4636  let t;
4637  for (const i in e)
4638    (i === "class" || i === "style" || ta(i)) && ((t || (t = {}))[i] = e[i]);
4639  return t;
4640}, Mx = (e, t) => {
4641  const i = {};
4642  for (const s in e)
4643    (!sh(s) || !(s.slice(9) in t)) && (i[s] = e[s]);
4644  return i;
4645};
4646function Cx(e, t, i) {
4647  const { props: s, children: n, component: r } = e, { props: o, children: a, patchFlag: l } = t, h = r.emitsOptions;
4648  if (t.dirs || t.transition)
4649    return !0;
4650  if (i && l >= 0) {
4651    if (l & 1024)
4652      return !0;
4653    if (l & 16)
4654      return s ? Vc(s, o, h) : !!o;
4655    if (l & 8) {
4656      const c = t.dynamicProps;
4657      for (let u = 0; u < c.length; u++) {
4658        const d = c[u];
4659        if (o[d] !== s[d] && !oa(h, d))
4660          return !0;
4661      }
4662    }
4663  } else
4664    return (n || a) && (!a || !a.$stable) ? !0 : s === o ? !1 : s ? o ? Vc(s, o, h) : !0 : !!o;
4665  return !1;
4666}
4667function Vc(e, t, i) {
4668  const s = Object.keys(t);
4669  if (s.length !== Object.keys(e).length)
4670    return !0;
4671  for (let n = 0; n < s.length; n++) {
4672    const r = s[n];
4673    if (t[r] !== e[r] && !oa(i, r))
4674      return !0;
4675  }
4676  return !1;
4677}
4678function bx({ vnode: e, parent: t }, i) {
4679  for (; t && t.subTree === e; )
4680    (e = t.vnode).el = i, t = t.parent;
4681}
4682const wx = (e) => e.__isSuspense;
4683function Sx(e, t) {
4684  t && t.pendingBranch ? it(e) ? t.effects.push(...e) : t.effects.push(e) : px(e);
4685}
4686const qr = {};
4687function Ia(e, t, i) {
4688  return bf(e, t, i);
4689}
4690function bf(e, t, { immediate: i, deep: s, flush: n, onTrack: r, onTrigger: o } = At) {
4691  var a;
4692  const l = k1() === ((a = se) == null ? void 0 : a.scope) ? se : null;
4693  let h, c = !1, u = !1;
4694  if (de(e) ? (h = () => e.value, c = yl(e)) : hn(e) ? (h = () => e, s = !0) : it(e) ? (u = !0, c = e.some((E) => hn(E) || yl(E)), h = () => e.map((E) => {
4695    if (de(E))
4696      return E.value;
4697    if (hn(E))
4698      return Qs(E);
4699    if (ht(E))
4700      return Ki(E, l, 2);
4701  })) : ht(e) ? t ? h = () => Ki(e, l, 2) : h = () => {
4702    if (!(l && l.isUnmounted))
4703      return d && d(), We(
4704        e,
4705        l,
4706        3,
4707        [f]
4708      );
4709  } : h = je, t && s) {
4710    const E = h;
4711    h = () => Qs(E());
4712  }
4713  let d, f = (E) => {
4714    d = y.onStop = () => {
4715      Ki(E, l, 4);
4716    };
4717  }, g;
4718  if (hr)
4719    if (f = je, t ? i && We(t, l, 3, [
4720      h(),
4721      u ? [] : void 0,
4722      f
4723    ]) : h(), n === "sync") {
4724      const E = vv();
4725      g = E.__watcherHandles || (E.__watcherHandles = []);
4726    } else
4727      return je;
4728  let _ = u ? new Array(e.length).fill(qr) : qr;
4729  const m = () => {
4730    if (y.active)
4731      if (t) {
4732        const E = y.run();
4733        (s || c || (u ? E.some(
4734          (C, w) => wo(C, _[w])
4735        ) : wo(E, _))) && (d && d(), We(t, l, 3, [
4736          E,
4737          // pass undefined as the old value when it's changed for the first time
4738          _ === qr ? void 0 : u && _[0] === qr ? [] : _,
4739          f
4740        ]), _ = E);
4741      } else
4742        y.run();
4743  };
4744  m.allowRecurse = !!t;
4745  let p;
4746  n === "sync" ? p = m : n === "post" ? p = () => _e(m, l && l.suspense) : (m.pre = !0, l && (m.id = l.uid), p = () => mh(m));
4747  const y = new lh(h, p);
4748  t ? i ? m() : _ = y.run() : n === "post" ? _e(
4749    y.run.bind(y),
4750    l && l.suspense
4751  ) : y.run();
4752  const v = () => {
4753    y.stop(), l && l.scope && nh(l.scope.effects, y);
4754  };
4755  return g && g.push(v), v;
4756}
4757function Tx(e, t, i) {
4758  const s = this.proxy, n = Wt(e) ? e.includes(".") ? wf(s, e) : () => s[e] : e.bind(s, s);
4759  let r;
4760  ht(t) ? r = t : (r = t.handler, i = t);
4761  const o = se;
4762  vn(this);
4763  const a = bf(n, r.bind(s), i);
4764  return o ? vn(o) : ms(), a;
4765}
4766function wf(e, t) {
4767  const i = t.split(".");
4768  return () => {
4769    let s = e;
4770    for (let n = 0; n < i.length && s; n++)
4771      s = s[i[n]];
4772    return s;
4773  };
4774}
4775function Qs(e, t) {
4776  if (!Ft(e) || e.__v_skip || (t = t || /* @__PURE__ */ new Set(), t.has(e)))
4777    return e;
4778  if (t.add(e), de(e))
4779    Qs(e.value, t);
4780  else if (it(e))
4781    for (let i = 0; i < e.length; i++)
4782      Qs(e[i], t);
4783  else if (Hd(e) || ln(e))
4784    e.forEach((i) => {
4785      Qs(i, t);
4786    });
4787  else if (Qd(e))
4788    for (const i in e)
4789      Qs(e[i], t);
4790  return e;
4791}
4792function rs(e, t, i, s) {
4793  const n = e.dirs, r = t && t.dirs;
4794  for (let o = 0; o < n.length; o++) {
4795    const a = n[o];
4796    r && (a.oldValue = r[o].value);
4797    let l = a.dir[s];
4798    l && (Rn(), We(l, i, 8, [
4799      e.el,
4800      a,
4801      e,
4802      t
4803    ]), In());
4804  }
4805}
4806function Rx(e, t) {
4807  return ht(e) ? (
4808    // #8326: extend call and options.name access are considered side-effects
4809    // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4810    /* @__PURE__ */ (() => jt({ name: e.name }, t, { setup: e }))()
4811  ) : e;
4812}
4813const Vn = (e) => !!e.type.__asyncLoader, Sf = (e) => e.type.__isKeepAlive;
4814function Ix(e, t) {
4815  Tf(e, "a", t);
4816}
4817function Px(e, t) {
4818  Tf(e, "da", t);
4819}
4820function Tf(e, t, i = se) {
4821  const s = e.__wdc || (e.__wdc = () => {
4822    let n = i;
4823    for (; n; ) {
4824      if (n.isDeactivated)
4825        return;
4826      n = n.parent;
4827    }
4828    return e();
4829  });
4830  if (aa(t, s, i), i) {
4831    let n = i.parent;
4832    for (; n && n.parent; )
4833      Sf(n.parent.vnode) && Ax(s, t, i, n), n = n.parent;
4834  }
4835}
4836function Ax(e, t, i, s) {
4837  const n = aa(
4838    t,
4839    e,
4840    s,
4841    !0
4842    /* prepend */
4843  );
4844  Rf(() => {
4845    nh(s[t], n);
4846  }, i);
4847}
4848function aa(e, t, i = se, s = !1) {
4849  if (i) {
4850    const n = i[e] || (i[e] = []), r = t.__weh || (t.__weh = (...o) => {
4851      if (i.isUnmounted)
4852        return;
4853      Rn(), vn(i);
4854      const a = We(t, i, e, o);
4855      return ms(), In(), a;
4856    });
4857    return s ? n.unshift(r) : n.push(r), r;
4858  }
4859}
4860const bi = (e) => (t, i = se) => (
4861  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4862  (!hr || e === "sp") && aa(e, (...s) => t(...s), i)
4863), Lx = bi("bm"), Ox = bi("m"), Fx = bi("bu"), kx = bi("u"), Dx = bi("bum"), Rf = bi("um"), Nx = bi("sp"), Gx = bi(
4864  "rtg"
4865), zx = bi(
4866  "rtc"
4867);
4868function jx(e, t = se) {
4869  aa("ec", e, t);
4870}
4871const Wx = Symbol.for("v-ndc");
4872function vl(e, t, i, s) {
4873  let n;
4874  const r = i && i[s];
4875  if (it(e) || Wt(e)) {
4876    n = new Array(e.length);
4877    for (let o = 0, a = e.length; o < a; o++)
4878      n[o] = t(e[o], o, void 0, r && r[o]);
4879  } else if (typeof e == "number") {
4880    n = new Array(e);
4881    for (let o = 0; o < e; o++)
4882      n[o] = t(o + 1, o, void 0, r && r[o]);
4883  } else if (Ft(e))
4884    if (e[Symbol.iterator])
4885      n = Array.from(
4886        e,
4887        (o, a) => t(o, a, void 0, r && r[a])
4888      );
4889    else {
4890      const o = Object.keys(e);
4891      n = new Array(o.length);
4892      for (let a = 0, l = o.length; a < l; a++) {
4893        const h = o[a];
4894        n[a] = t(e[h], h, a, r && r[a]);
4895      }
4896    }
4897  else
4898    n = [];
4899  return i && (i[s] = n), n;
4900}
4901function If(e, t, i = {}, s, n) {
4902  if (pe.isCE || pe.parent && Vn(pe.parent) && pe.parent.isCE)
4903    return t !== "default" && (i.name = t), Be("slot", i, s && s());
4904  let r = e[t];
4905  r && r._c && (r._d = !1), wt();
4906  const o = r && Pf(r(i)), a = jf(
4907    me,
4908    {
4909      key: i.key || // slot content array of a dynamic conditional slot may have a branch
4910      // key attached in the `createSlots` helper, respect that
4911      o && o.key || `_${t}`
4912    },
4913    o || (s ? s() : []),
4914    o && e._ === 1 ? 64 : -2
4915  );
4916  return !n && a.scopeId && (a.slotScopeIds = [a.scopeId + "-s"]), r && r._c && (r._d = !0), a;
4917}
4918function Pf(e) {
4919  return e.some((t) => Wf(t) ? !(t.type === Qi || t.type === me && !Pf(t.children)) : !0) ? e : null;
4920}
4921const El = (e) => e ? Xf(e) ? Eh(e) || e.proxy : El(e.parent) : null, Hn = (
4922  // Move PURE marker to new line to workaround compiler discarding it
4923  // due to type annotation
4924  /* @__PURE__ */ jt(/* @__PURE__ */ Object.create(null), {
4925    $: (e) => e,
4926    $el: (e) => e.vnode.el,
4927    $data: (e) => e.data,
4928    $props: (e) => e.props,
4929    $attrs: (e) => e.attrs,
4930    $slots: (e) => e.slots,
4931    $refs: (e) => e.refs,
4932    $parent: (e) => El(e.parent),
4933    $root: (e) => El(e.root),
4934    $emit: (e) => e.emit,
4935    $options: (e) => ph(e),
4936    $forceUpdate: (e) => e.f || (e.f = () => mh(e.update)),
4937    $nextTick: (e) => e.n || (e.n = yf.bind(e.proxy)),
4938    $watch: (e) => Tx.bind(e)
4939  })
4940), Pa = (e, t) => e !== At && !e.__isScriptSetup && _t(e, t), Bx = {
4941  get({ _: e }, t) {
4942    const { ctx: i, setupState: s, data: n, props: r, accessCache: o, type: a, appContext: l } = e;
4943    let h;
4944    if (t[0] !== "$") {
4945      const f = o[t];
4946      if (f !== void 0)
4947        switch (f) {
4948          case 1:
4949            return s[t];
4950          case 2:
4951            return n[t];
4952          case 4:
4953            return i[t];
4954          case 3:
4955            return r[t];
4956        }
4957      else {
4958        if (Pa(s, t))
4959          return o[t] = 1, s[t];
4960        if (n !== At && _t(n, t))
4961          return o[t] = 2, n[t];
4962        if (
4963          // only cache other properties when instance has declared (thus stable)
4964          // props
4965          (h = e.propsOptions[0]) && _t(h, t)
4966        )
4967          return o[t] = 3, r[t];
4968        if (i !== At && _t(i, t))
4969          return o[t] = 4, i[t];
4970        Ml && (o[t] = 0);
4971      }
4972    }
4973    const c = Hn[t];
4974    let u, d;
4975    if (c)
4976      return t === "$attrs" && Ee(e, "get", t), c(e);
4977    if (
4978      // css module (injected by vue-loader)
4979      (u = a.__cssModules) && (u = u[t])
4980    )
4981      return u;
4982    if (i !== At && _t(i, t))
4983      return o[t] = 4, i[t];
4984    if (
4985      // global properties
4986      d = l.config.globalProperties, _t(d, t)
4987    )
4988      return d[t];
4989  },
4990  set({ _: e }, t, i) {
4991    const { data: s, setupState: n, ctx: r } = e;
4992    return Pa(n, t) ? (n[t] = i, !0) : s !== At && _t(s, t) ? (s[t] = i, !0) : _t(e.props, t) || t[0] === "$" && t.slice(1) in e ? !1 : (r[t] = i, !0);
4993  },
4994  has({
4995    _: { data: e, setupState: t, accessCache: i, ctx: s, appContext: n, propsOptions: r }
4996  }, o) {
4997    let a;
4998    return !!i[o] || e !== At && _t(e, o) || Pa(t, o) || (a = r[0]) && _t(a, o) || _t(s, o) || _t(Hn, o) || _t(n.config.globalProperties, o);
4999  },
5000  defineProperty(e, t, i) {
5001    return i.get != null ? e._.accessCache[t] = 0 : _t(i, "value") && this.set(e, t, i.value, null), Reflect.defineProperty(e, t, i);
5002  }
5003};
5004function Hc(e) {
5005  return it(e) ? e.reduce(
5006    (t, i) => (t[i] = null, t),
5007    {}
5008  ) : e;
5009}
5010let Ml = !0;
5011function Ux(e) {
5012  const t = ph(e), i = e.proxy, s = e.ctx;
5013  Ml = !1, t.beforeCreate && Zc(t.beforeCreate, e, "bc");
5014  const {
5015    // state
5016    data: n,
5017    computed: r,
5018    methods: o,
5019    watch: a,
5020    provide: l,
5021    inject: h,
5022    // lifecycle
5023    created: c,
5024    beforeMount: u,
5025    mounted: d,
5026    beforeUpdate: f,
5027    updated: g,
5028    activated: _,
5029    deactivated: m,
5030    beforeDestroy: p,
5031    beforeUnmount: y,
5032    destroyed: v,
5033    unmounted: E,
5034    render: C,
5035    renderTracked: w,
5036    renderTriggered: O,
5037    errorCaptured: R,
5038    serverPrefetch: j,
5039    // public API
5040    expose: $,
5041    inheritAttrs: V,
5042    // assets
5043    components: tt,
5044    directives: J,
5045    filters: St
5046  } = t;
5047  if (h && Xx(h, s, null), o)
5048    for (const L in o) {
5049      const W = o[L];
5050      ht(W) && (s[L] = W.bind(i));
5051    }
5052  if (n) {
5053    const L = n.call(i, i);
5054    Ft(L) && (e.data = na(L));
5055  }
5056  if (Ml = !0, r)
5057    for (const L in r) {
5058      const W = r[L], ut = ht(W) ? W.bind(i, i) : ht(W.get) ? W.get.bind(i, i) : je, ft = !ht(W) && ht(W.set) ? W.set.bind(i) : je, Tt = yv({
5059        get: ut,
5060        set: ft
5061      });
5062      Object.defineProperty(s, L, {
5063        enumerable: !0,
5064        configurable: !0,
5065        get: () => Tt.value,
5066        set: (I) => Tt.value = I
5067      });
5068    }
5069  if (a)
5070    for (const L in a)
5071      Af(a[L], s, i, L);
5072  if (l) {
5073    const L = ht(l) ? l.call(i) : l;
5074    Reflect.ownKeys(L).forEach((W) => {
5075      Hx(W, L[W]);
5076    });
5077  }
5078  c && Zc(c, e, "c");
5079  function Y(L, W) {
5080    it(W) ? W.forEach((ut) => L(ut.bind(i))) : W && L(W.bind(i));
5081  }
5082  if (Y(Lx, u), Y(Ox, d), Y(Fx, f), Y(kx, g), Y(Ix, _), Y(Px, m), Y(jx, R), Y(zx, w), Y(Gx, O), Y(Dx, y), Y(Rf, E), Y(Nx, j), it($))
5083    if ($.length) {
5084      const L = e.exposed || (e.exposed = {});
5085      $.forEach((W) => {
5086        Object.defineProperty(L, W, {
5087          get: () => i[W],
5088          set: (ut) => i[W] = ut
5089        });
5090      });
5091    } else
5092      e.exposed || (e.exposed = {});
5093  C && e.render === je && (e.render = C), V != null && (e.inheritAttrs = V), tt && (e.components = tt), J && (e.directives = J);
5094}
5095function Xx(e, t, i = je) {
5096  it(e) && (e = Cl(e));
5097  for (const s in e) {
5098    const n = e[s];
5099    let r;
5100    Ft(n) ? "default" in n ? r = po(
5101      n.from || s,
5102      n.default,
5103      !0
5104      /* treat default function as factory */
5105    ) : r = po(n.from || s) : r = po(n), de(r) ? Object.defineProperty(t, s, {
5106      enumerable: !0,
5107      configurable: !0,
5108      get: () => r.value,
5109      set: (o) => r.value = o
5110    }) : t[s] = r;
5111  }
5112}
5113function Zc(e, t, i) {
5114  We(
5115    it(e) ? e.map((s) => s.bind(t.proxy)) : e.bind(t.proxy),
5116    t,
5117    i
5118  );
5119}
5120function Af(e, t, i, s) {
5121  const n = s.includes(".") ? wf(i, s) : () => i[s];
5122  if (Wt(e)) {
5123    const r = t[e];
5124    ht(r) && Ia(n, r);
5125  } else if (ht(e))
5126    Ia(n, e.bind(i));
5127  else if (Ft(e))
5128    if (it(e))
5129      e.forEach((r) => Af(r, t, i, s));
5130    else {
5131      const r = ht(e.handler) ? e.handler.bind(i) : t[e.handler];
5132      ht(r) && Ia(n, r, e);
5133    }
5134}
5135function ph(e) {
5136  const t = e.type, { mixins: i, extends: s } = t, {
5137    mixins: n,
5138    optionsCache: r,
5139    config: { optionMergeStrategies: o }
5140  } = e.appContext, a = r.get(t);
5141  let l;
5142  return a ? l = a : !n.length && !i && !s ? l = t : (l = {}, n.length && n.forEach(
5143    (h) => Ro(l, h, o, !0)
5144  ), Ro(l, t, o)), Ft(t) && r.set(t, l), l;
5145}
5146function Ro(e, t, i, s = !1) {
5147  const { mixins: n, extends: r } = t;
5148  r && Ro(e, r, i, !0), n && n.forEach(
5149    (o) => Ro(e, o, i, !0)
5150  );
5151  for (const o in t)
5152    if (!(s && o === "expose")) {
5153      const a = $x[o] || i && i[o];
5154      e[o] = a ? a(e[o], t[o]) : t[o];
5155    }
5156  return e;
5157}
5158const $x = {
5159  data: Jc,
5160  props: Qc,
5161  emits: Qc,
5162  // objects
5163  methods: Xn,
5164  computed: Xn,
5165  // lifecycle
5166  beforeCreate: ae,
5167  created: ae,
5168  beforeMount: ae,
5169  mounted: ae,
5170  beforeUpdate: ae,
5171  updated: ae,
5172  beforeDestroy: ae,
5173  beforeUnmount: ae,
5174  destroyed: ae,
5175  unmounted: ae,
5176  activated: ae,
5177  deactivated: ae,
5178  errorCaptured: ae,
5179  serverPrefetch: ae,
5180  // assets
5181  components: Xn,
5182  directives: Xn,
5183  // watch
5184  watch: Kx,
5185  // provide / inject
5186  provide: Jc,
5187  inject: Yx
5188};
5189function Jc(e, t) {
5190  return t ? e ? function() {
5191    return jt(
5192      ht(e) ? e.call(this, this) : e,
5193      ht(t) ? t.call(this, this) : t
5194    );
5195  } : t : e;
5196}
5197function Yx(e, t) {
5198  return Xn(Cl(e), Cl(t));
5199}
5200function Cl(e) {
5201  if (it(e)) {
5202    const t = {};
5203    for (let i = 0; i < e.length; i++)
5204      t[e[i]] = e[i];
5205    return t;
5206  }
5207  return e;
5208}
5209function ae(e, t) {
5210  return e ? [...new Set([].concat(e, t))] : t;
5211}
5212function Xn(e, t) {
5213  return e ? jt(/* @__PURE__ */ Object.create(null), e, t) : t;
5214}
5215function Qc(e, t) {
5216  return e ? it(e) && it(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : jt(
5217    /* @__PURE__ */ Object.create(null),
5218    Hc(e),
5219    Hc(t ?? {})
5220  ) : t;
5221}
5222function Kx(e, t) {
5223  if (!e)
5224    return t;
5225  if (!t)
5226    return e;
5227  const i = jt(/* @__PURE__ */ Object.create(null), e);
5228  for (const s in t)
5229    i[s] = ae(e[s], t[s]);
5230  return i;
5231}
5232function Lf() {
5233  return {
5234    app: null,
5235    config: {
5236      isNativeTag: v1,
5237      performance: !1,
5238      globalProperties: {},
5239      optionMergeStrategies: {},
5240      errorHandler: void 0,
5241      warnHandler: void 0,
5242      compilerOptions: {}
5243    },
5244    mixins: [],
5245    components: {},
5246    directives: {},
5247    provides: /* @__PURE__ */ Object.create(null),
5248    optionsCache: /* @__PURE__ */ new WeakMap(),
5249    propsCache: /* @__PURE__ */ new WeakMap(),
5250    emitsCache: /* @__PURE__ */ new WeakMap()
5251  };
5252}
5253let qx = 0;
5254function Vx(e, t) {
5255  return function(s, n = null) {
5256    ht(s) || (s = jt({}, s)), n != null && !Ft(n) && (n = null);
5257    const r = Lf(), o = /* @__PURE__ */ new Set();
5258    let a = !1;
5259    const l = r.app = {
5260      _uid: qx++,
5261      _component: s,
5262      _props: n,
5263      _container: null,
5264      _context: r,
5265      _instance: null,
5266      version: Ev,
5267      get config() {
5268        return r.config;
5269      },
5270      set config(h) {
5271      },
5272      use(h, ...c) {
5273        return o.has(h) || (h && ht(h.install) ? (o.add(h), h.install(l, ...c)) : ht(h) && (o.add(h), h(l, ...c))), l;
5274      },
5275      mixin(h) {
5276        return r.mixins.includes(h) || r.mixins.push(h), l;
5277      },
5278      component(h, c) {
5279        return c ? (r.components[h] = c, l) : r.components[h];
5280      },
5281      directive(h, c) {
5282        return c ? (r.directives[h] = c, l) : r.directives[h];
5283      },
5284      mount(h, c, u) {
5285        if (!a) {
5286          const d = Be(
5287            s,
5288            n
5289          );
5290          return d.appContext = r, c && t ? t(d, h) : e(d, h, u), a = !0, l._container = h, h.__vue_app__ = l, Eh(d.component) || d.component.proxy;
5291        }
5292      },
5293      unmount() {
5294        a && (e(null, l._container), delete l._container.__vue_app__);
5295      },
5296      provide(h, c) {
5297        return r.provides[h] = c, l;
5298      },
5299      runWithContext(h) {
5300        Io = l;
5301        try {
5302          return h();
5303        } finally {
5304          Io = null;
5305        }
5306      }
5307    };
5308    return l;
5309  };
5310}
5311let Io = null;
5312function Hx(e, t) {
5313  if (se) {
5314    let i = se.provides;
5315    const s = se.parent && se.parent.provides;
5316    s === i && (i = se.provides = Object.create(s)), i[e] = t;
5317  }
5318}
5319function po(e, t, i = !1) {
5320  const s = se || pe;
5321  if (s || Io) {
5322    const n = s ? s.parent == null ? s.vnode.appContext && s.vnode.appContext.provides : s.parent.provides : Io._context.provides;
5323    if (n && e in n)
5324      return n[e];
5325    if (arguments.length > 1)
5326      return i && ht(t) ? t.call(s && s.proxy) : t;
5327  }
5328}
5329function Zx(e, t, i, s = !1) {
5330  const n = {}, r = {};
5331  So(r, ha, 1), e.propsDefaults = /* @__PURE__ */ Object.create(null), Of(e, t, n, r);
5332  for (const o in e.propsOptions[0])
5333    o in n || (n[o] = void 0);
5334  i ? e.props = s ? n : lx(n) : e.type.props ? e.props = n : e.props = r, e.attrs = r;
5335}
5336function Jx(e, t, i, s) {
5337  const {
5338    props: n,
5339    attrs: r,
5340    vnode: { patchFlag: o }
5341  } = e, a = Ct(n), [l] = e.propsOptions;
5342  let h = !1;
5343  if (
5344    // always force full diff in dev
5345    // - #1942 if hmr is enabled with sfc component
5346    // - vite#872 non-sfc component used by sfc component
5347    (s || o > 0) && !(o & 16)
5348  ) {
5349    if (o & 8) {
5350      const c = e.vnode.dynamicProps;
5351      for (let u = 0; u < c.length; u++) {
5352        let d = c[u];
5353        if (oa(e.emitsOptions, d))
5354          continue;
5355        const f = t[d];
5356        if (l)
5357          if (_t(r, d))
5358            f !== r[d] && (r[d] = f, h = !0);
5359          else {
5360            const g = mi(d);
5361            n[g] = bl(
5362              l,
5363              a,
5364              g,
5365              f,
5366              e,
5367              !1
5368              /* isAbsent */
5369            );
5370          }
5371        else
5372          f !== r[d] && (r[d] = f, h = !0);
5373      }
5374    }
5375  } else {
5376    Of(e, t, n, r) && (h = !0);
5377    let c;
5378    for (const u in a)
5379      (!t || // for camelCase
5380      !_t(t, u) && // it's possible the original props was passed in as kebab-case
5381      // and converted to camelCase (#955)
5382      ((c = De(u)) === u || !_t(t, c))) && (l ? i && // for camelCase
5383      (i[u] !== void 0 || // for kebab-case
5384      i[c] !== void 0) && (n[u] = bl(
5385        l,
5386        a,
5387        u,
5388        void 0,
5389        e,
5390        !0
5391        /* isAbsent */
5392      )) : delete n[u]);
5393    if (r !== a)
5394      for (const u in r)
5395        (!t || !_t(t, u)) && (delete r[u], h = !0);
5396  }
5397  h && Ei(e, "set", "$attrs");
5398}
5399function Of(e, t, i, s) {
5400  const [n, r] = e.propsOptions;
5401  let o = !1, a;
5402  if (t)
5403    for (let l in t) {
5404      if (mo(l))
5405        continue;
5406      const h = t[l];
5407      let c;
5408      n && _t(n, c = mi(l)) ? !r || !r.includes(c) ? i[c] = h : (a || (a = {}))[c] = h : oa(e.emitsOptions, l) || (!(l in s) || h !== s[l]) && (s[l] = h, o = !0);
5409    }
5410  if (r) {
5411    const l = Ct(i), h = a || At;
5412    for (let c = 0; c < r.length; c++) {
5413      const u = r[c];
5414      i[u] = bl(
5415        n,
5416        l,
5417        u,
5418        h[u],
5419        e,
5420        !_t(h, u)
5421      );
5422    }
5423  }
5424  return o;
5425}
5426function bl(e, t, i, s, n, r) {
5427  const o = e[i];
5428  if (o != null) {
5429    const a = _t(o, "default");
5430    if (a && s === void 0) {
5431      const l = o.default;
5432      if (o.type !== Function && !o.skipFactory && ht(l)) {
5433        const { propsDefaults: h } = n;
5434        i in h ? s = h[i] : (vn(n), s = h[i] = l.call(
5435          null,
5436          t
5437        ), ms());
5438      } else
5439        s = l;
5440    }
5441    o[
5442      0
5443      /* shouldCast */
5444    ] && (r && !a ? s = !1 : o[
5445      1
5446      /* shouldCastTrue */
5447    ] && (s === "" || s === De(i)) && (s = !0));
5448  }
5449  return s;
5450}
5451function Ff(e, t, i = !1) {
5452  const s = t.propsCache, n = s.get(e);
5453  if (n)
5454    return n;
5455  const r = e.props, o = {}, a = [];
5456  let l = !1;
5457  if (!ht(e)) {
5458    const c = (u) => {
5459      l = !0;
5460      const [d, f] = Ff(u, t, !0);
5461      jt(o, d), f && a.push(...f);
5462    };
5463    !i && t.mixins.length && t.mixins.forEach(c), e.extends && c(e.extends), e.mixins && e.mixins.forEach(c);
5464  }
5465  if (!r && !l)
5466    return Ft(e) && s.set(e, an), an;
5467  if (it(r))
5468    for (let c = 0; c < r.length; c++) {
5469      const u = mi(r[c]);
5470      tu(u) && (o[u] = At);
5471    }
5472  else if (r)
5473    for (const c in r) {
5474      const u = mi(c);
5475      if (tu(u)) {
5476        const d = r[c], f = o[u] = it(d) || ht(d) ? { type: d } : jt({}, d);
5477        if (f) {
5478          const g = su(Boolean, f.type), _ = su(String, f.type);
5479          f[
5480            0
5481            /* shouldCast */
5482          ] = g > -1, f[
5483            1
5484            /* shouldCastTrue */
5485          ] = _ < 0 || g < _, (g > -1 || _t(f, "default")) && a.push(u);
5486        }
5487      }
5488    }
5489  const h = [o, a];
5490  return Ft(e) && s.set(e, h), h;
5491}
5492function tu(e) {
5493  return e[0] !== "$";
5494}
5495function eu(e) {
5496  const t = e && e.toString().match(/^\s*(function|class) (\w+)/);
5497  return t ? t[2] : e === null ? "null" : "";
5498}
5499function iu(e, t) {
5500  return eu(e) === eu(t);
5501}
5502function su(e, t) {
5503  return it(t) ? t.findIndex((i) => iu(i, e)) : ht(t) && iu(t, e) ? 0 : -1;
5504}
5505const kf = (e) => e[0] === "_" || e === "$stable", yh = (e) => it(e) ? e.map(Ye) : [Ye(e)], Qx = (e, t, i) => {
5506  if (t._n)
5507    return t;
5508  const s = vx((...n) => yh(t(...n)), i);
5509  return s._c = !1, s;
5510}, Df = (e, t, i) => {
5511  const s = e._ctx;
5512  for (const n in e) {
5513    if (kf(n))
5514      continue;
5515    const r = e[n];
5516    if (ht(r))
5517      t[n] = Qx(n, r, s);
5518    else if (r != null) {
5519      const o = yh(r);
5520      t[n] = () => o;
5521    }
5522  }
5523}, Nf = (e, t) => {
5524  const i = yh(t);
5525  e.slots.default = () => i;
5526}, tv = (e, t) => {
5527  if (e.vnode.shapeFlag & 32) {
5528    const i = t._;
5529    i ? (e.slots = Ct(t), So(t, "_", i)) : Df(
5530      t,
5531      e.slots = {}
5532    );
5533  } else
5534    e.slots = {}, t && Nf(e, t);
5535  So(e.slots, ha, 1);
5536}, ev = (e, t, i) => {
5537  const { vnode: s, slots: n } = e;
5538  let r = !0, o = At;
5539  if (s.shapeFlag & 32) {
5540    const a = t._;
5541    a ? i && a === 1 ? r = !1 : (jt(n, t), !i && a === 1 && delete n._) : (r = !t.$stable, Df(t, n)), o = t;
5542  } else
5543    t && (Nf(e, t), o = { default: 1 });
5544  if (r)
5545    for (const a in n)
5546      !kf(a) && !(a in o) && delete n[a];
5547};
5548function wl(e, t, i, s, n = !1) {
5549  if (it(e)) {
5550    e.forEach(
5551      (d, f) => wl(
5552        d,
5553        t && (it(t) ? t[f] : t),
5554        i,
5555        s,
5556        n
5557      )
5558    );
5559    return;
5560  }
5561  if (Vn(s) && !n)
5562    return;
5563  const r = s.shapeFlag & 4 ? Eh(s.component) || s.component.proxy : s.el, o = n ? null : r, { i: a, r: l } = e, h = t && t.r, c = a.refs === At ? a.refs = {} : a.refs, u = a.setupState;
5564  if (h != null && h !== l && (Wt(h) ? (c[h] = null, _t(u, h) && (u[h] = null)) : de(h) && (h.value = null)), ht(l))
5565    Ki(l, a, 12, [o, c]);
5566  else {
5567    const d = Wt(l), f = de(l);
5568    if (d || f) {
5569      const g = () => {
5570        if (e.f) {
5571          const _ = d ? _t(u, l) ? u[l] : c[l] : l.value;
5572          n ? it(_) && nh(_, r) : it(_) ? _.includes(r) || _.push(r) : d ? (c[l] = [r], _t(u, l) && (u[l] = c[l])) : (l.value = [r], e.k && (c[e.k] = l.value));
5573        } else
5574          d ? (c[l] = o, _t(u, l) && (u[l] = o)) : f && (l.value = o, e.k && (c[e.k] = o));
5575      };
5576      o ? (g.id = -1, _e(g, i)) : g();
5577    }
5578  }
5579}
5580const _e = Sx;
5581function iv(e) {
5582  return sv(e);
5583}
5584function sv(e, t) {
5585  const i = fl();
5586  i.__VUE__ = !0;
5587  const {
5588    insert: s,
5589    remove: n,
5590    patchProp: r,
5591    createElement: o,
5592    createText: a,
5593    createComment: l,
5594    setText: h,
5595    setElementText: c,
5596    parentNode: u,
5597    nextSibling: d,
5598    setScopeId: f = je,
5599    insertStaticContent: g
5600  } = e, _ = (x, M, b, T = null, S = null, k = null, N = !1, F = null, D = !!M.dynamicChildren) => {
5601    if (x === M)
5602      return;
5603    x && !kn(x, M) && (T = oe(x), I(x, S, k, !0), x = null), M.patchFlag === -2 && (D = !1, M.dynamicChildren = null);
5604    const { type: P, ref: B, shapeFlag: z } = M;
5605    switch (P) {
5606      case la:
5607        m(x, M, b, T);
5608        break;
5609      case Qi:
5610        p(x, M, b, T);
5611        break;
5612      case Aa:
5613        x == null && y(M, b, T, N);
5614        break;
5615      case me:
5616        tt(
5617          x,
5618          M,
5619          b,
5620          T,
5621          S,
5622          k,
5623          N,
5624          F,
5625          D
5626        );
5627        break;
5628      default:
5629        z & 1 ? C(
5630          x,
5631          M,
5632          b,
5633          T,
5634          S,
5635          k,
5636          N,
5637          F,
5638          D
5639        ) : z & 6 ? J(
5640          x,
5641          M,
5642          b,
5643          T,
5644          S,
5645          k,
5646          N,
5647          F,
5648          D
5649        ) : (z & 64 || z & 128) && P.process(
5650          x,
5651          M,
5652          b,
5653          T,
5654          S,
5655          k,
5656          N,
5657          F,
5658          D,
5659          Ht
5660        );
5661    }
5662    B != null && S && wl(B, x && x.ref, k, M || x, !M);
5663  }, m = (x, M, b, T) => {
5664    if (x == null)
5665      s(
5666        M.el = a(M.children),
5667        b,
5668        T
5669      );
5670    else {
5671      const S = M.el = x.el;
5672      M.children !== x.children && h(S, M.children);
5673    }
5674  }, p = (x, M, b, T) => {
5675    x == null ? s(
5676      M.el = l(M.children || ""),
5677      b,
5678      T
5679    ) : M.el = x.el;
5680  }, y = (x, M, b, T) => {
5681    [x.el, x.anchor] = g(
5682      x.children,
5683      M,
5684      b,
5685      T,
5686      x.el,
5687      x.anchor
5688    );
5689  }, v = ({ el: x, anchor: M }, b, T) => {
5690    let S;
5691    for (; x && x !== M; )
5692      S = d(x), s(x, b, T), x = S;
5693    s(M, b, T);
5694  }, E = ({ el: x, anchor: M }) => {
5695    let b;
5696    for (; x && x !== M; )
5697      b = d(x), n(x), x = b;
5698    n(M);
5699  }, C = (x, M, b, T, S, k, N, F, D) => {
5700    N = N || M.type === "svg", x == null ? w(
5701      M,
5702      b,
5703      T,
5704      S,
5705      k,
5706      N,
5707      F,
5708      D
5709    ) : j(
5710      x,
5711      M,
5712      S,
5713      k,
5714      N,
5715      F,
5716      D
5717    );
5718  }, w = (x, M, b, T, S, k, N, F) => {
5719    let D, P;
5720    const { type: B, props: z, shapeFlag: X, transition: q, dirs: nt } = x;
5721    if (D = x.el = o(
5722      x.type,
5723      k,
5724      z && z.is,
5725      z
5726    ), X & 8 ? c(D, x.children) : X & 16 && R(
5727      x.children,
5728      D,
5729      null,
5730      T,
5731      S,
5732      k && B !== "foreignObject",
5733      N,
5734      F
5735    ), nt && rs(x, null, T, "created"), O(D, x, x.scopeId, N, T), z) {
5736      for (const ct in z)
5737        ct !== "value" && !mo(ct) && r(
5738          D,
5739          ct,
5740          null,
5741          z[ct],
5742          k,
5743          x.children,
5744          T,
5745          S,
5746          Bt
5747        );
5748      "value" in z && r(D, "value", null, z.value), (P = z.onVnodeBeforeMount) && $e(P, T, x);
5749    }
5750    nt && rs(x, null, T, "beforeMount");
5751    const gt = (!S || S && !S.pendingBranch) && q && !q.persisted;
5752    gt && q.beforeEnter(D), s(D, M, b), ((P = z && z.onVnodeMounted) || gt || nt) && _e(() => {
5753      P && $e(P, T, x), gt && q.enter(D), nt && rs(x, null, T, "mounted");
5754    }, S);
5755  }, O = (x, M, b, T, S) => {
5756    if (b && f(x, b), T)
5757      for (let k = 0; k < T.length; k++)
5758        f(x, T[k]);
5759    if (S) {
5760      let k = S.subTree;
5761      if (M === k) {
5762        const N = S.vnode;
5763        O(
5764          x,
5765          N,
5766          N.scopeId,
5767          N.slotScopeIds,
5768          S.parent
5769        );
5770      }
5771    }
5772  }, R = (x, M, b, T, S, k, N, F, D = 0) => {
5773    for (let P = D; P < x.length; P++) {
5774      const B = x[P] = F ? Fi(x[P]) : Ye(x[P]);
5775      _(
5776        null,
5777        B,
5778        M,
5779        b,
5780        T,
5781        S,
5782        k,
5783        N,
5784        F
5785      );
5786    }
5787  }, j = (x, M, b, T, S, k, N) => {
5788    const F = M.el = x.el;
5789    let { patchFlag: D, dynamicChildren: P, dirs: B } = M;
5790    D |= x.patchFlag & 16;
5791    const z = x.props || At, X = M.props || At;
5792    let q;
5793    b && os(b, !1), (q = X.onVnodeBeforeUpdate) && $e(q, b, M, x), B && rs(M, x, b, "beforeUpdate"), b && os(b, !0);
5794    const nt = S && M.type !== "foreignObject";
5795    if (P ? $(
5796      x.dynamicChildren,
5797      P,
5798      F,
5799      b,
5800      T,
5801      nt,
5802      k
5803    ) : N || W(
5804      x,
5805      M,
5806      F,
5807      null,
5808      b,
5809      T,
5810      nt,
5811      k,
5812      !1
5813    ), D > 0) {
5814      if (D & 16)
5815        V(
5816          F,
5817          M,
5818          z,
5819          X,
5820          b,
5821          T,
5822          S
5823        );
5824      else if (D & 2 && z.class !== X.class && r(F, "class", null, X.class, S), D & 4 && r(F, "style", z.style, X.style, S), D & 8) {
5825        const gt = M.dynamicProps;
5826        for (let ct = 0; ct < gt.length; ct++) {
5827          const bt = gt[ct], Zt = z[bt], kt = X[bt];
5828          (kt !== Zt || bt === "value") && r(
5829            F,
5830            bt,
5831            Zt,
5832            kt,
5833            S,
5834            x.children,
5835            b,
5836            T,
5837            Bt
5838          );
5839        }
5840      }
5841      D & 1 && x.children !== M.children && c(F, M.children);
5842    } else
5843      !N && P == null && V(
5844        F,
5845        M,
5846        z,
5847        X,
5848        b,
5849        T,
5850        S
5851      );
5852    ((q = X.onVnodeUpdated) || B) && _e(() => {
5853      q && $e(q, b, M, x), B && rs(M, x, b, "updated");
5854    }, T);
5855  }, $ = (x, M, b, T, S, k, N) => {
5856    for (let F = 0; F < M.length; F++) {
5857      const D = x[F], P = M[F], B = (
5858        // oldVNode may be an errored async setup() component inside Suspense
5859        // which will not have a mounted element
5860        D.el && // - In the case of a Fragment, we need to provide the actual parent
5861        // of the Fragment itself so it can move its children.
5862        (D.type === me || // - In the case of different nodes, there is going to be a replacement
5863        // which also requires the correct parent container
5864        !kn(D, P) || // - In the case of a component, it could contain anything.
5865        D.shapeFlag & 70) ? u(D.el) : (
5866          // In other cases, the parent container is not actually used so we
5867          // just pass the block element here to avoid a DOM parentNode call.
5868          b
5869        )
5870      );
5871      _(
5872        D,
5873        P,
5874        B,
5875        null,
5876        T,
5877        S,
5878        k,
5879        N,
5880        !0
5881      );
5882    }
5883  }, V = (x, M, b, T, S, k, N) => {
5884    if (b !== T) {
5885      if (b !== At)
5886        for (const F in b)
5887          !mo(F) && !(F in T) && r(
5888            x,
5889            F,
5890            b[F],
5891            null,
5892            N,
5893            M.children,
5894            S,
5895            k,
5896            Bt
5897          );
5898      for (const F in T) {
5899        if (mo(F))
5900          continue;
5901        const D = T[F], P = b[F];
5902        D !== P && F !== "value" && r(
5903          x,
5904          F,
5905          P,
5906          D,
5907          N,
5908          M.children,
5909          S,
5910          k,
5911          Bt
5912        );
5913      }
5914      "value" in T && r(x, "value", b.value, T.value);
5915    }
5916  }, tt = (x, M, b, T, S, k, N, F, D) => {
5917    const P = M.el = x ? x.el : a(""), B = M.anchor = x ? x.anchor : a("");
5918    let { patchFlag: z, dynamicChildren: X, slotScopeIds: q } = M;
5919    q && (F = F ? F.concat(q) : q), x == null ? (s(P, b, T), s(B, b, T), R(
5920      M.children,
5921      b,
5922      B,
5923      S,
5924      k,
5925      N,
5926      F,
5927      D
5928    )) : z > 0 && z & 64 && X && // #2715 the previous fragment could've been a BAILed one as a result
5929    // of renderSlot() with no valid children
5930    x.dynamicChildren ? ($(
5931      x.dynamicChildren,
5932      X,
5933      b,
5934      S,
5935      k,
5936      N,
5937      F
5938    ), // #2080 if the stable fragment has a key, it's a <template v-for> that may
5939    //  get moved around. Make sure all root level vnodes inherit el.
5940    // #2134 or if it's a component root, it may also get moved around
5941    // as the component is being moved.
5942    (M.key != null || S && M === S.subTree) && Gf(
5943      x,
5944      M,
5945      !0
5946      /* shallow */
5947    )) : W(
5948      x,
5949      M,
5950      b,
5951      B,
5952      S,
5953      k,
5954      N,
5955      F,
5956      D
5957    );
5958  }, J = (x, M, b, T, S, k, N, F, D) => {
5959    M.slotScopeIds = F, x == null ? M.shapeFlag & 512 ? S.ctx.activate(
5960      M,
5961      b,
5962      T,
5963      N,
5964      D
5965    ) : St(
5966      M,
5967      b,
5968      T,
5969      S,
5970      k,
5971      N,
5972      D
5973    ) : K(x, M, D);
5974  }, St = (x, M, b, T, S, k, N) => {
5975    const F = x.component = dv(
5976      x,
5977      T,
5978      S
5979    );
5980    if (Sf(x) && (F.ctx.renderer = Ht), fv(F), F.asyncDep) {
5981      if (S && S.registerDep(F, Y), !x.el) {
5982        const D = F.subTree = Be(Qi);
5983        p(null, D, M, b);
5984      }
5985      return;
5986    }
5987    Y(
5988      F,
5989      x,
5990      M,
5991      b,
5992      S,
5993      k,
5994      N
5995    );
5996  }, K = (x, M, b) => {
5997    const T = M.component = x.component;
5998    if (Cx(x, M, b))
5999      if (T.asyncDep && !T.asyncResolved) {
6000        L(T, M, b);
6001        return;
6002      } else
6003        T.next = M, mx(T.update), T.update();
6004    else
6005      M.el = x.el, T.vnode = M;
6006  }, Y = (x, M, b, T, S, k, N) => {
6007    const F = () => {
6008      if (x.isMounted) {
6009        let { next: B, bu: z, u: X, parent: q, vnode: nt } = x, gt = B, ct;
6010        os(x, !1), B ? (B.el = nt.el, L(x, B, N)) : B = nt, z && Ta(z), (ct = B.props && B.props.onVnodeBeforeUpdate) && $e(ct, q, B, nt), os(x, !0);
6011        const bt = Ra(x), Zt = x.subTree;
6012        x.subTree = bt, _(
6013          Zt,
6014          bt,
6015          // parent may have changed if it's in a teleport
6016          u(Zt.el),
6017          // anchor may have changed if it's in a fragment
6018          oe(Zt),
6019          x,
6020          S,
6021          k
6022        ), B.el = bt.el, gt === null && bx(x, bt.el), X && _e(X, S), (ct = B.props && B.props.onVnodeUpdated) && _e(
6023          () => $e(ct, q, B, nt),
6024          S
6025        );
6026      } else {
6027        let B;
6028        const { el: z, props: X } = M, { bm: q, m: nt, parent: gt } = x, ct = Vn(M);
6029        if (os(x, !1), q && Ta(q), !ct && (B = X && X.onVnodeBeforeMount) && $e(B, gt, M), os(x, !0), z && Si) {
6030          const bt = () => {
6031            x.subTree = Ra(x), Si(
6032              z,
6033              x.subTree,
6034              x,
6035              S,
6036              null
6037            );
6038          };
6039          ct ? M.type.__asyncLoader().then(
6040            // note: we are moving the render call into an async callback,
6041            // which means it won't track dependencies - but it's ok because
6042            // a server-rendered async wrapper is already in resolved state
6043            // and it will never need to change.
6044            () => !x.isUnmounted && bt()
6045          ) : bt();
6046        } else {
6047          const bt = x.subTree = Ra(x);
6048          _(
6049            null,
6050            bt,
6051            b,
6052            T,
6053            x,
6054            S,
6055            k
6056          ), M.el = bt.el;
6057        }
6058        if (nt && _e(nt, S), !ct && (B = X && X.onVnodeMounted)) {
6059          const bt = M;
6060          _e(
6061            () => $e(B, gt, bt),
6062            S
6063          );
6064        }
6065        (M.shapeFlag & 256 || gt && Vn(gt.vnode) && gt.vnode.shapeFlag & 256) && x.a && _e(x.a, S), x.isMounted = !0, M = b = T = null;
6066      }
6067    }, D = x.effect = new lh(
6068      F,
6069      () => mh(P),
6070      x.scope
6071      // track it in component's effect scope
6072    ), P = x.update = () => D.run();
6073    P.id = x.uid, os(x, !0), P();
6074  }, L = (x, M, b) => {
6075    M.component = x;
6076    const T = x.vnode.props;
6077    x.vnode = M, x.next = null, Jx(x, M.props, T, b), ev(x, M.children, b), Rn(), qc(), In();
6078  }, W = (x, M, b, T, S, k, N, F, D = !1) => {
6079    const P = x && x.children, B = x ? x.shapeFlag : 0, z = M.children, { patchFlag: X, shapeFlag: q } = M;
6080    if (X > 0) {
6081      if (X & 128) {
6082        ft(
6083          P,
6084          z,
6085          b,
6086          T,
6087          S,
6088          k,
6089          N,
6090          F,
6091          D
6092        );
6093        return;
6094      } else if (X & 256) {
6095        ut(
6096          P,
6097          z,
6098          b,
6099          T,
6100          S,
6101          k,
6102          N,
6103          F,
6104          D
6105        );
6106        return;
6107      }
6108    }
6109    q & 8 ? (B & 16 && Bt(P, S, k), z !== P && c(b, z)) : B & 16 ? q & 16 ? ft(
6110      P,
6111      z,
6112      b,
6113      T,
6114      S,
6115      k,
6116      N,
6117      F,
6118      D
6119    ) : Bt(P, S, k, !0) : (B & 8 && c(b, ""), q & 16 && R(
6120      z,
6121      b,
6122      T,
6123      S,
6124      k,
6125      N,
6126      F,
6127      D
6128    ));
6129  }, ut = (x, M, b, T, S, k, N, F, D) => {
6130    x = x || an, M = M || an;
6131    const P = x.length, B = M.length, z = Math.min(P, B);
6132    let X;
6133    for (X = 0; X < z; X++) {
6134      const q = M[X] = D ? Fi(M[X]) : Ye(M[X]);
6135      _(
6136        x[X],
6137        q,
6138        b,
6139        null,
6140        S,
6141        k,
6142        N,
6143        F,
6144        D
6145      );
6146    }
6147    P > B ? Bt(
6148      x,
6149      S,
6150      k,
6151      !0,
6152      !1,
6153      z
6154    ) : R(
6155      M,
6156      b,
6157      T,
6158      S,
6159      k,
6160      N,
6161      F,
6162      D,
6163      z
6164    );
6165  }, ft = (x, M, b, T, S, k, N, F, D) => {
6166    let P = 0;
6167    const B = M.length;
6168    let z = x.length - 1, X = B - 1;
6169    for (; P <= z && P <= X; ) {
6170      const q = x[P], nt = M[P] = D ? Fi(M[P]) : Ye(M[P]);
6171      if (kn(q, nt))
6172        _(
6173          q,
6174          nt,
6175          b,
6176          null,
6177          S,
6178          k,
6179          N,
6180          F,
6181          D
6182        );
6183      else
6184        break;
6185      P++;
6186    }
6187    for (; P <= z && P <= X; ) {
6188      const q = x[z], nt = M[X] = D ? Fi(M[X]) : Ye(M[X]);
6189      if (kn(q, nt))
6190        _(
6191          q,
6192          nt,
6193          b,
6194          null,
6195          S,
6196          k,
6197          N,
6198          F,
6199          D
6200        );
6201      else
6202        break;
6203      z--, X--;
6204    }
6205    if (P > z) {
6206      if (P <= X) {
6207        const q = X + 1, nt = q < B ? M[q].el : T;
6208        for (; P <= X; )
6209          _(
6210            null,
6211            M[P] = D ? Fi(M[P]) : Ye(M[P]),
6212            b,
6213            nt,
6214            S,
6215            k,
6216            N,
6217            F,
6218            D
6219          ), P++;
6220      }
6221    } else if (P > X)
6222      for (; P <= z; )
6223        I(x[P], S, k, !0), P++;
6224    else {
6225      const q = P, nt = P, gt = /* @__PURE__ */ new Map();
6226      for (P = nt; P <= X; P++) {
6227        const Jt = M[P] = D ? Fi(M[P]) : Ye(M[P]);
6228        Jt.key != null && gt.set(Jt.key, P);
6229      }
6230      let ct, bt = 0;
6231      const Zt = X - nt + 1;
6232      let kt = !1, Os = 0;
6233      const ss = new Array(Zt);
6234      for (P = 0; P < Zt; P++)
6235        ss[P] = 0;
6236      for (P = q; P <= z; P++) {
6237        const Jt = x[P];
6238        if (bt >= Zt) {
6239          I(Jt, S, k, !0);
6240          continue;
6241        }
6242        let Ce;
6243        if (Jt.key != null)
6244          Ce = gt.get(Jt.key);
6245        else
6246          for (ct = nt; ct <= X; ct++)
6247            if (ss[ct - nt] === 0 && kn(Jt, M[ct])) {
6248              Ce = ct;
6249              break;
6250            }
6251        Ce === void 0 ? I(Jt, S, k, !0) : (ss[Ce - nt] = P + 1, Ce >= Os ? Os = Ce : kt = !0, _(
6252          Jt,
6253          M[Ce],
6254          b,
6255          null,
6256          S,
6257          k,
6258          N,
6259          F,
6260          D
6261        ), bt++);
6262      }
6263      const Nr = kt ? nv(ss) : an;
6264      for (ct = Nr.length - 1, P = Zt - 1; P >= 0; P--) {
6265        const Jt = nt + P, Ce = M[Jt], Fs = Jt + 1 < B ? M[Jt + 1].el : T;
6266        ss[P] === 0 ? _(
6267          null,
6268          Ce,
6269          b,
6270          Fs,
6271          S,
6272          k,
6273          N,
6274          F,
6275          D
6276        ) : kt && (ct < 0 || P !== Nr[ct] ? Tt(Ce, b, Fs, 2) : ct--);
6277      }
6278    }
6279  }, Tt = (x, M, b, T, S = null) => {
6280    const { el: k, type: N, transition: F, children: D, shapeFlag: P } = x;
6281    if (P & 6) {
6282      Tt(x.component.subTree, M, b, T);
6283      return;
6284    }
6285    if (P & 128) {
6286      x.suspense.move(M, b, T);
6287      return;
6288    }
6289    if (P & 64) {
6290      N.move(x, M, b, Ht);
6291      return;
6292    }
6293    if (N === me) {
6294      s(k, M, b);
6295      for (let z = 0; z < D.length; z++)
6296        Tt(D[z], M, b, T);
6297      s(x.anchor, M, b);
6298      return;
6299    }
6300    if (N === Aa) {
6301      v(x, M, b);
6302      return;
6303    }
6304    if (T !== 2 && P & 1 && F)
6305      if (T === 0)
6306        F.beforeEnter(k), s(k, M, b), _e(() => F.enter(k), S);
6307      else {
6308        const { leave: z, delayLeave: X, afterLeave: q } = F, nt = () => s(k, M, b), gt = () => {
6309          z(k, () => {
6310            nt(), q && q();
6311          });
6312        };
6313        X ? X(k, nt, gt) : gt();
6314      }
6315    else
6316      s(k, M, b);
6317  }, I = (x, M, b, T = !1, S = !1) => {
6318    const {
6319      type: k,
6320      props: N,
6321      ref: F,
6322      children: D,
6323      dynamicChildren: P,
6324      shapeFlag: B,
6325      patchFlag: z,
6326      dirs: X
6327    } = x;
6328    if (F != null && wl(F, null, b, x, !0), B & 256) {
6329      M.ctx.deactivate(x);
6330      return;
6331    }
6332    const q = B & 1 && X, nt = !Vn(x);
6333    let gt;
6334    if (nt && (gt = N && N.onVnodeBeforeUnmount) && $e(gt, M, x), B & 6)
6335      vt(x.component, b, T);
6336    else {
6337      if (B & 128) {
6338        x.suspense.unmount(b, T);
6339        return;
6340      }
6341      q && rs(x, null, M, "beforeUnmount"), B & 64 ? x.type.remove(
6342        x,
6343        M,
6344        b,
6345        S,
6346        Ht,
6347        T
6348      ) : P && // #1153: fast path should not be taken for non-stable (v-for) fragments
6349      (k !== me || z > 0 && z & 64) ? Bt(
6350        P,
6351        M,
6352        b,
6353        !1,
6354        !0
6355      ) : (k === me && z & 384 || !S && B & 16) && Bt(D, M, b), T && Vt(x);
6356    }
6357    (nt && (gt = N && N.onVnodeUnmounted) || q) && _e(() => {
6358      gt && $e(gt, M, x), q && rs(x, null, M, "unmounted");
6359    }, b);
6360  }, Vt = (x) => {
6361    const { type: M, el: b, anchor: T, transition: S } = x;
6362    if (M === me) {
6363      pt(b, T);
6364      return;
6365    }
6366    if (M === Aa) {
6367      E(x);
6368      return;
6369    }
6370    const k = () => {
6371      n(b), S && !S.persisted && S.afterLeave && S.afterLeave();
6372    };
6373    if (x.shapeFlag & 1 && S && !S.persisted) {
6374      const { leave: N, delayLeave: F } = S, D = () => N(b, k);
6375      F ? F(x.el, k, D) : D();
6376    } else
6377      k();
6378  }, pt = (x, M) => {
6379    let b;
6380    for (; x !== M; )
6381      b = d(x), n(x), x = b;
6382    n(M);
6383  }, vt = (x, M, b) => {
6384    const { bum: T, scope: S, update: k, subTree: N, um: F } = x;
6385    T && Ta(T), S.stop(), k && (k.active = !1, I(N, x, M, b)), F && _e(F, M), _e(() => {
6386      x.isUnmounted = !0;
6387    }, M), M && M.pendingBranch && !M.isUnmounted && x.asyncDep && !x.asyncResolved && x.suspenseId === M.pendingId && (M.deps--, M.deps === 0 && M.resolve());
6388  }, Bt = (x, M, b, T = !1, S = !1, k = 0) => {
6389    for (let N = k; N < x.length; N++)
6390      I(x[N], M, b, T, S);
6391  }, oe = (x) => x.shapeFlag & 6 ? oe(x.component.subTree) : x.shapeFlag & 128 ? x.suspense.next() : d(x.anchor || x.el), Gt = (x, M, b) => {
6392    x == null ? M._vnode && I(M._vnode, null, null, !0) : _(M._vnode || null, x, M, null, null, null, b), qc(), vf(), M._vnode = x;
6393  }, Ht = {
6394    p: _,
6395    um: I,
6396    m: Tt,
6397    r: Vt,
6398    mt: St,
6399    mc: R,
6400    pc: W,
6401    pbc: $,
6402    n: oe,
6403    o: e
6404  };
6405  let Ue, Si;
6406  return t && ([Ue, Si] = t(
6407    Ht
6408  )), {
6409    render: Gt,
6410    hydrate: Ue,
6411    createApp: Vx(Gt, Ue)
6412  };
6413}
6414function os({ effect: e, update: t }, i) {
6415  e.allowRecurse = t.allowRecurse = i;
6416}
6417function Gf(e, t, i = !1) {
6418  const s = e.children, n = t.children;
6419  if (it(s) && it(n))
6420    for (let r = 0; r < s.length; r++) {
6421      const o = s[r];
6422      let a = n[r];
6423      a.shapeFlag & 1 && !a.dynamicChildren && ((a.patchFlag <= 0 || a.patchFlag === 32) && (a = n[r] = Fi(n[r]), a.el = o.el), i || Gf(o, a)), a.type === la && (a.el = o.el);
6424    }
6425}
6426function nv(e) {
6427  const t = e.slice(), i = [0];
6428  let s, n, r, o, a;
6429  const l = e.length;
6430  for (s = 0; s < l; s++) {
6431    const h = e[s];
6432    if (h !== 0) {
6433      if (n = i[i.length - 1], e[n] < h) {
6434        t[s] = n, i.push(s);
6435        continue;
6436      }
6437      for (r = 0, o = i.length - 1; r < o; )
6438        a = r + o >> 1, e[i[a]] < h ? r = a + 1 : o = a;
6439      h < e[i[r]] && (r > 0 && (t[s] = i[r - 1]), i[r] = s);
6440    }
6441  }
6442  for (r = i.length, o = i[r - 1]; r-- > 0; )
6443    i[r] = o, o = t[o];
6444  return i;
6445}
6446const rv = (e) => e.__isTeleport, me = Symbol.for("v-fgt"), la = Symbol.for("v-txt"), Qi = Symbol.for("v-cmt"), Aa = Symbol.for("v-stc"), Zn = [];
6447let Ge = null;
6448function wt(e = !1) {
6449  Zn.push(Ge = e ? null : []);
6450}
6451function ov() {
6452  Zn.pop(), Ge = Zn[Zn.length - 1] || null;
6453}
6454let lr = 1;
6455function nu(e) {
6456  lr += e;
6457}
6458function zf(e) {
6459  return e.dynamicChildren = lr > 0 ? Ge || an : null, ov(), lr > 0 && Ge && Ge.push(e), e;
6460}
6461function It(e, t, i, s, n, r) {
6462  return zf(
6463    Nt(
6464      e,
6465      t,
6466      i,
6467      s,
6468      n,
6469      r,
6470      !0
6471      /* isBlock */
6472    )
6473  );
6474}
6475function jf(e, t, i, s, n) {
6476  return zf(
6477    Be(
6478      e,
6479      t,
6480      i,
6481      s,
6482      n,
6483      !0
6484      /* isBlock: prevent a block from tracking itself */
6485    )
6486  );
6487}
6488function Wf(e) {
6489  return e ? e.__v_isVNode === !0 : !1;
6490}
6491function kn(e, t) {
6492  return e.type === t.type && e.key === t.key;
6493}
6494const ha = "__vInternal", Bf = ({ key: e }) => e ?? null, yo = ({
6495  ref: e,
6496  ref_key: t,
6497  ref_for: i
6498}) => (typeof e == "number" && (e = "" + e), e != null ? Wt(e) || de(e) || ht(e) ? { i: pe, r: e, k: t, f: !!i } : e : null);
6499function Nt(e, t = null, i = null, s = 0, n = null, r = e === me ? 0 : 1, o = !1, a = !1) {
6500  const l = {
6501    __v_isVNode: !0,
6502    __v_skip: !0,
6503    type: e,
6504    props: t,
6505    key: t && Bf(t),
6506    ref: t && yo(t),
6507    scopeId: Cf,
6508    slotScopeIds: null,
6509    children: i,
6510    component: null,
6511    suspense: null,
6512    ssContent: null,
6513    ssFallback: null,
6514    dirs: null,
6515    transition: null,
6516    el: null,
6517    anchor: null,
6518    target: null,
6519    targetAnchor: null,
6520    staticCount: 0,
6521    shapeFlag: r,
6522    patchFlag: s,
6523    dynamicProps: n,
6524    dynamicChildren: null,
6525    appContext: null,
6526    ctx: pe
6527  };
6528  return a ? (xh(l, i), r & 128 && e.normalize(l)) : i && (l.shapeFlag |= Wt(i) ? 8 : 16), lr > 0 && // avoid a block node from tracking itself
6529  !o && // has current parent block
6530  Ge && // presence of a patch flag indicates this node needs patching on updates.
6531  // component nodes also should always be patched, because even if the
6532  // component doesn't need to update, it needs to persist the instance on to
6533  // the next vnode so that it can be properly unmounted later.
6534  (l.patchFlag > 0 || r & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
6535  // vnode should not be considered dynamic due to handler caching.
6536  l.patchFlag !== 32 && Ge.push(l), l;
6537}
6538const Be = av;
6539function av(e, t = null, i = null, s = 0, n = null, r = !1) {
6540  if ((!e || e === Wx) && (e = Qi), Wf(e)) {
6541    const a = xn(
6542      e,
6543      t,
6544      !0
6545      /* mergeRef: true */
6546    );
6547    return i && xh(a, i), lr > 0 && !r && Ge && (a.shapeFlag & 6 ? Ge[Ge.indexOf(e)] = a : Ge.push(a)), a.patchFlag |= -2, a;
6548  }
6549  if (pv(e) && (e = e.__vccOpts), t) {
6550    t = lv(t);
6551    let { class: a, style: l } = t;
6552    a && !Wt(a) && (t.class = bs(a)), Ft(l) && (_f(l) && !it(l) && (l = jt({}, l)), t.style = Pr(l));
6553  }
6554  const o = Wt(e) ? 1 : wx(e) ? 128 : rv(e) ? 64 : Ft(e) ? 4 : ht(e) ? 2 : 0;
6555  return Nt(
6556    e,
6557    t,
6558    i,
6559    s,
6560    n,
6561    o,
6562    r,
6563    !0
6564  );
6565}
6566function lv(e) {
6567  return e ? _f(e) || ha in e ? jt({}, e) : e : null;
6568}
6569function xn(e, t, i = !1) {
6570  const { props: s, ref: n, patchFlag: r, children: o } = e, a = t ? hv(s || {}, t) : s;
6571  return {
6572    __v_isVNode: !0,
6573    __v_skip: !0,
6574    type: e.type,
6575    props: a,
6576    key: a && Bf(a),
6577    ref: t && t.ref ? (
6578      // #2078 in the case of <component :is="vnode" ref="extra"/>
6579      // if the vnode itself already has a ref, cloneVNode will need to merge
6580      // the refs so the single vnode can be set on multiple refs
6581      i && n ? it(n) ? n.concat(yo(t)) : [n, yo(t)] : yo(t)
6582    ) : n,
6583    scopeId: e.scopeId,
6584    slotScopeIds: e.slotScopeIds,
6585    children: o,
6586    target: e.target,
6587    targetAnchor: e.targetAnchor,
6588    staticCount: e.staticCount,
6589    shapeFlag: e.shapeFlag,
6590    // if the vnode is cloned with extra props, we can no longer assume its
6591    // existing patch flag to be reliable and need to add the FULL_PROPS flag.
6592    // note: preserve flag for fragments since they use the flag for children
6593    // fast paths only.
6594    patchFlag: t && e.type !== me ? r === -1 ? 16 : r | 16 : r,
6595    dynamicProps: e.dynamicProps,
6596    dynamicChildren: e.dynamicChildren,
6597    appContext: e.appContext,
6598    dirs: e.dirs,
6599    transition: e.transition,
6600    // These should technically only be non-null on mounted VNodes. However,
6601    // they *should* be copied for kept-alive vnodes. So we just always copy
6602    // them since them being non-null during a mount doesn't affect the logic as
6603    // they will simply be overwritten.
6604    component: e.component,
6605    suspense: e.suspense,
6606    ssContent: e.ssContent && xn(e.ssContent),
6607    ssFallback: e.ssFallback && xn(e.ssFallback),
6608    el: e.el,
6609    anchor: e.anchor,
6610    ctx: e.ctx,
6611    ce: e.ce
6612  };
6613}
6614function Uf(e = " ", t = 0) {
6615  return Be(la, null, e, t);
6616}
6617function qi(e = "", t = !1) {
6618  return t ? (wt(), jf(Qi, null, e)) : Be(Qi, null, e);
6619}
6620function Ye(e) {
6621  return e == null || typeof e == "boolean" ? Be(Qi) : it(e) ? Be(
6622    me,
6623    null,
6624    // #3666, avoid reference pollution when reusing vnode
6625    e.slice()
6626  ) : typeof e == "object" ? Fi(e) : Be(la, null, String(e));
6627}
6628function Fi(e) {
6629  return e.el === null && e.patchFlag !== -1 || e.memo ? e : xn(e);
6630}
6631function xh(e, t) {
6632  let i = 0;
6633  const { shapeFlag: s } = e;
6634  if (t == null)
6635    t = null;
6636  else if (it(t))
6637    i = 16;
6638  else if (typeof t == "object")
6639    if (s & 65) {
6640      const n = t.default;
6641      n && (n._c && (n._d = !1), xh(e, n()), n._c && (n._d = !0));
6642      return;
6643    } else {
6644      i = 32;
6645      const n = t._;
6646      !n && !(ha in t) ? t._ctx = pe : n === 3 && pe && (pe.slots._ === 1 ? t._ = 1 : (t._ = 2, e.patchFlag |= 1024));
6647    }
6648  else
6649    ht(t) ? (t = { default: t, _ctx: pe }, i = 32) : (t = String(t), s & 64 ? (i = 16, t = [Uf(t)]) : i = 8);
6650  e.children = t, e.shapeFlag |= i;
6651}
6652function hv(...e) {
6653  const t = {};
6654  for (let i = 0; i < e.length; i++) {
6655    const s = e[i];
6656    for (const n in s)
6657      if (n === "class")
6658        t.class !== s.class && (t.class = bs([t.class, s.class]));
6659      else if (n === "style")
6660        t.style = Pr([t.style, s.style]);
6661      else if (ta(n)) {
6662        const r = t[n], o = s[n];
6663        o && r !== o && !(it(r) && r.includes(o)) && (t[n] = r ? [].concat(r, o) : o);
6664      } else
6665        n !== "" && (t[n] = s[n]);
6666  }
6667  return t;
6668}
6669function $e(e, t, i, s = null) {
6670  We(e, t, 7, [
6671    i,
6672    s
6673  ]);
6674}
6675const cv = Lf();
6676let uv = 0;
6677function dv(e, t, i) {
6678  const s = e.type, n = (t ? t.appContext : e.appContext) || cv, r = {
6679    uid: uv++,
6680    vnode: e,
6681    type: s,
6682    parent: t,
6683    appContext: n,
6684    root: null,
6685    // to be immediately set
6686    next: null,
6687    subTree: null,
6688    // will be set synchronously right after creation
6689    effect: null,
6690    update: null,
6691    // will be set synchronously right after creation
6692    scope: new O1(
6693      !0
6694      /* detached */
6695    ),
6696    render: null,
6697    proxy: null,
6698    exposed: null,
6699    exposeProxy: null,
6700    withProxy: null,
6701    provides: t ? t.provides : Object.create(n.provides),
6702    accessCache: null,
6703    renderCache: [],
6704    // local resolved assets
6705    components: null,
6706    directives: null,
6707    // resolved props and emits options
6708    propsOptions: Ff(s, n),
6709    emitsOptions: Mf(s, n),
6710    // emit
6711    emit: null,
6712    // to be set immediately
6713    emitted: null,
6714    // props default value
6715    propsDefaults: At,
6716    // inheritAttrs
6717    inheritAttrs: s.inheritAttrs,
6718    // state
6719    ctx: At,
6720    data: At,
6721    props: At,
6722    attrs: At,
6723    slots: At,
6724    refs: At,
6725    setupState: At,
6726    setupContext: null,
6727    attrsProxy: null,
6728    slotsProxy: null,
6729    // suspense related
6730    suspense: i,
6731    suspenseId: i ? i.pendingId : 0,
6732    asyncDep: null,
6733    asyncResolved: !1,
6734    // lifecycle hooks
6735    // not using enums here because it results in computed properties
6736    isMounted: !1,
6737    isUnmounted: !1,
6738    isDeactivated: !1,
6739    bc: null,
6740    c: null,
6741    bm: null,
6742    m: null,
6743    bu: null,
6744    u: null,
6745    um: null,
6746    bum: null,
6747    da: null,
6748    a: null,
6749    rtg: null,
6750    rtc: null,
6751    ec: null,
6752    sp: null
6753  };
6754  return r.ctx = { _: r }, r.root = t ? t.root : r, r.emit = xx.bind(null, r), e.ce && e.ce(r), r;
6755}
6756let se = null, vh, Ns, ru = "__VUE_INSTANCE_SETTERS__";
6757(Ns = fl()[ru]) || (Ns = fl()[ru] = []), Ns.push((e) => se = e), vh = (e) => {
6758  Ns.length > 1 ? Ns.forEach((t) => t(e)) : Ns[0](e);
6759};
6760const vn = (e) => {
6761  vh(e), e.scope.on();
6762}, ms = () => {
6763  se && se.scope.off(), vh(null);
6764};
6765function Xf(e) {
6766  return e.vnode.shapeFlag & 4;
6767}
6768let hr = !1;
6769function fv(e, t = !1) {
6770  hr = t;
6771  const { props: i, children: s } = e.vnode, n = Xf(e);
6772  Zx(e, i, n, t), tv(e, s);
6773  const r = n ? gv(e, t) : void 0;
6774  return hr = !1, r;
6775}
6776function gv(e, t) {
6777  const i = e.type;
6778  e.accessCache = /* @__PURE__ */ Object.create(null), e.proxy = yn(new Proxy(e.ctx, Bx));
6779  const { setup: s } = i;
6780  if (s) {
6781    const n = e.setupContext = s.length > 1 ? mv(e) : null;
6782    vn(e), Rn();
6783    const r = Ki(
6784      s,
6785      e,
6786      0,
6787      [e.props, n]
6788    );
6789    if (In(), ms(), Zd(r)) {
6790      if (r.then(ms, ms), t)
6791        return r.then((o) => {
6792          ou(e, o, t);
6793        }).catch((o) => {
6794          ra(o, e, 0);
6795        });
6796      e.asyncDep = r;
6797    } else
6798      ou(e, r, t);
6799  } else
6800    $f(e, t);
6801}
6802function ou(e, t, i) {
6803  ht(t) ? e.type.__ssrInlineRender ? e.ssrRender = t : e.render = t : Ft(t) && (e.setupState = mf(t)), $f(e, i);
6804}
6805let au;
6806function $f(e, t, i) {
6807  const s = e.type;
6808  if (!e.render) {
6809    if (!t && au && !s.render) {
6810      const n = s.template || ph(e).template;
6811      if (n) {
6812        const { isCustomElement: r, compilerOptions: o } = e.appContext.config, { delimiters: a, compilerOptions: l } = s, h = jt(
6813          jt(
6814            {
6815              isCustomElement: r,
6816              delimiters: a
6817            },
6818            o
6819          ),
6820          l
6821        );
6822        s.render = au(n, h);
6823      }
6824    }
6825    e.render = s.render || je;
6826  }
6827  vn(e), Rn(), Ux(e), In(), ms();
6828}
6829function _v(e) {
6830  return e.attrsProxy || (e.attrsProxy = new Proxy(
6831    e.attrs,
6832    {
6833      get(t, i) {
6834        return Ee(e, "get", "$attrs"), t[i];
6835      }
6836    }
6837  ));
6838}
6839function mv(e) {
6840  const t = (i) => {
6841    e.exposed = i || {};
6842  };
6843  return {
6844    get attrs() {
6845      return _v(e);
6846    },
6847    slots: e.slots,
6848    emit: e.emit,
6849    expose: t
6850  };
6851}
6852function Eh(e) {
6853  if (e.exposed)
6854    return e.exposeProxy || (e.exposeProxy = new Proxy(mf(yn(e.exposed)), {
6855      get(t, i) {
6856        if (i in t)
6857          return t[i];
6858        if (i in Hn)
6859          return Hn[i](e);
6860      },
6861      has(t, i) {
6862        return i in t || i in Hn;
6863      }
6864    }));
6865}
6866function pv(e) {
6867  return ht(e) && "__vccOpts" in e;
6868}
6869const yv = (e, t) => gx(e, t, hr), xv = Symbol.for("v-scx"), vv = () => po(xv), Ev = "3.3.4", Mv = "http://www.w3.org/2000/svg", cs = typeof document < "u" ? document : null, lu = cs && /* @__PURE__ */ cs.createElement("template"), Cv = {
6870  insert: (e, t, i) => {
6871    t.insertBefore(e, i || null);
6872  },
6873  remove: (e) => {
6874    const t = e.parentNode;
6875    t && t.removeChild(e);
6876  },
6877  createElement: (e, t, i, s) => {
6878    const n = t ? cs.createElementNS(Mv, e) : cs.createElement(e, i ? { is: i } : void 0);
6879    return e === "select" && s && s.multiple != null && n.setAttribute("multiple", s.multiple), n;
6880  },
6881  createText: (e) => cs.createTextNode(e),
6882  createComment: (e) => cs.createComment(e),
6883  setText: (e, t) => {
6884    e.nodeValue = t;
6885  },
6886  setElementText: (e, t) => {
6887    e.textContent = t;
6888  },
6889  parentNode: (e) => e.parentNode,
6890  nextSibling: (e) => e.nextSibling,
6891  querySelector: (e) => cs.querySelector(e),
6892  setScopeId(e, t) {
6893    e.setAttribute(t, "");
6894  },
6895  // __UNSAFE__
6896  // Reason: innerHTML.
6897  // Static content here can only come from compiled templates.
6898  // As long as the user only uses trusted templates, this is safe.
6899  insertStaticContent(e, t, i, s, n, r) {
6900    const o = i ? i.previousSibling : t.lastChild;
6901    if (n && (n === r || n.nextSibling))
6902      for (; t.insertBefore(n.cloneNode(!0), i), !(n === r || !(n = n.nextSibling)); )
6903        ;
6904    else {
6905      lu.innerHTML = s ? `<svg>${e}</svg>` : e;
6906      const a = lu.content;
6907      if (s) {
6908        const l = a.firstChild;
6909        for (; l.firstChild; )
6910          a.appendChild(l.firstChild);
6911        a.removeChild(l);
6912      }
6913      t.insertBefore(a, i);
6914    }
6915    return [
6916      // first
6917      o ? o.nextSibling : t.firstChild,
6918      // last
6919      i ? i.previousSibling : t.lastChild
6920    ];
6921  }
6922};
6923function bv(e, t, i) {
6924  const s = e._vtc;
6925  s && (t = (t ? [t, ...s] : [...s]).join(" ")), t == null ? e.removeAttribute("class") : i ? e.setAttribute("class", t) : e.className = t;
6926}
6927function wv(e, t, i) {
6928  const s = e.style, n = Wt(i);
6929  if (i && !n) {
6930    if (t && !Wt(t))
6931      for (const r in t)
6932        i[r] == null && Sl(s, r, "");
6933    for (const r in i)
6934      Sl(s, r, i[r]);
6935  } else {
6936    const r = s.display;
6937    n ? t !== i && (s.cssText = i) : t && e.removeAttribute("style"), "_vod" in e && (s.display = r);
6938  }
6939}
6940const hu = /\s*!important$/;
6941function Sl(e, t, i) {
6942  if (it(i))
6943    i.forEach((s) => Sl(e, t, s));
6944  else if (i == null && (i = ""), t.startsWith("--"))
6945    e.setProperty(t, i);
6946  else {
6947    const s = Sv(e, t);
6948    hu.test(i) ? e.setProperty(
6949      De(s),
6950      i.replace(hu, ""),
6951      "important"
6952    ) : e[s] = i;
6953  }
6954}
6955const cu = ["Webkit", "Moz", "ms"], La = {};
6956function Sv(e, t) {
6957  const i = La[t];
6958  if (i)
6959    return i;
6960  let s = mi(t);
6961  if (s !== "filter" && s in e)
6962    return La[t] = s;
6963  s = tf(s);
6964  for (let n = 0; n < cu.length; n++) {
6965    const r = cu[n] + s;
6966    if (r in e)
6967      return La[t] = r;
6968  }
6969  return t;
6970}
6971const uu = "http://www.w3.org/1999/xlink";
6972function Tv(e, t, i, s, n) {
6973  if (s && t.startsWith("xlink:"))
6974    i == null ? e.removeAttributeNS(uu, t.slice(6, t.length)) : e.setAttributeNS(uu, t, i);
6975  else {
6976    const r = L1(t);
6977    i == null || r && !ef(i) ? e.removeAttribute(t) : e.setAttribute(t, r ? "" : i);
6978  }
6979}
6980function Rv(e, t, i, s, n, r, o) {
6981  if (t === "innerHTML" || t === "textContent") {
6982    s && o(s, n, r), e[t] = i ?? "";
6983    return;
6984  }
6985  const a = e.tagName;
6986  if (t === "value" && a !== "PROGRESS" && // custom elements may use _value internally
6987  !a.includes("-")) {
6988    e._value = i;
6989    const h = a === "OPTION" ? e.getAttribute("value") : e.value, c = i ?? "";
6990    h !== c && (e.value = c), i == null && e.removeAttribute(t);
6991    return;
6992  }
6993  let l = !1;
6994  if (i === "" || i == null) {
6995    const h = typeof e[t];
6996    h === "boolean" ? i = ef(i) : i == null && h === "string" ? (i = "", l = !0) : h === "number" && (i = 0, l = !0);
6997  }
6998  try {
6999    e[t] = i;
7000  } catch {
7001  }
7002  l && e.removeAttribute(t);
7003}
7004function Iv(e, t, i, s) {
7005  e.addEventListener(t, i, s);
7006}
7007function Pv(e, t, i, s) {
7008  e.removeEventListener(t, i, s);
7009}
7010function Av(e, t, i, s, n = null) {
7011  const r = e._vei || (e._vei = {}), o = r[t];
7012  if (s && o)
7013    o.value = s;
7014  else {
7015    const [a, l] = Lv(t);
7016    if (s) {
7017      const h = r[t] = kv(s, n);
7018      Iv(e, a, h, l);
7019    } else
7020      o && (Pv(e, a, o, l), r[t] = void 0);
7021  }
7022}
7023const du = /(?:Once|Passive|Capture)$/;
7024function Lv(e) {
7025  let t;
7026  if (du.test(e)) {
7027    t = {};
7028    let s;
7029    for (; s = e.match(du); )
7030      e = e.slice(0, e.length - s[0].length), t[s[0].toLowerCase()] = !0;
7031  }
7032  return [e[2] === ":" ? e.slice(3) : De(e.slice(2)), t];
7033}
7034let Oa = 0;
7035const Ov = /* @__PURE__ */ Promise.resolve(), Fv = () => Oa || (Ov.then(() => Oa = 0), Oa = Date.now());
7036function kv(e, t) {
7037  const i = (s) => {
7038    if (!s._vts)
7039      s._vts = Date.now();
7040    else if (s._vts <= i.attached)
7041      return;
7042    We(
7043      Dv(s, i.value),
7044      t,
7045      5,
7046      [s]
7047    );
7048  };
7049  return i.value = e, i.attached = Fv(), i;
7050}
7051function Dv(e, t) {
7052  if (it(t)) {
7053    const i = e.stopImmediatePropagation;
7054    return e.stopImmediatePropagation = () => {
7055      i.call(e), e._stopped = !0;
7056    }, t.map((s) => (n) => !n._stopped && s && s(n));
7057  } else
7058    return t;
7059}
7060const fu = /^on[a-z]/, Nv = (e, t, i, s, n = !1, r, o, a, l) => {
7061  t === "class" ? bv(e, s, n) : t === "style" ? wv(e, i, s) : ta(t) ? sh(t) || Av(e, t, i, s, o) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Gv(e, t, s, n)) ? Rv(
7062    e,
7063    t,
7064    s,
7065    r,
7066    o,
7067    a,
7068    l
vendor: 4,468 bytes, lines 7069-7195
7069  ) : (t === "true-value" ? e._trueValue = s : t === "false-value" && (e._falseValue = s), Tv(e, t, s, n));
7070};
7071function Gv(e, t, i, s) {
7072  return s ? !!(t === "innerHTML" || t === "textContent" || t in e && fu.test(t) && ht(i)) : t === "spellcheck" || t === "draggable" || t === "translate" || t === "form" || t === "list" && e.tagName === "INPUT" || t === "type" && e.tagName === "TEXTAREA" || fu.test(t) && Wt(i) ? !1 : t in e;
7073}
7074function Ps(e, t) {
7075  const i = Rx(e);
7076  class s extends Mh {
7077    constructor(r) {
7078      super(i, r, t);
7079    }
7080  }
7081  return s.def = i, s;
7082}
7083const zv = typeof HTMLElement < "u" ? HTMLElement : class {
7084};
7085class Mh extends zv {
7086  constructor(t, i = {}, s) {
7087    super(), this._def = t, this._props = i, this._instance = null, this._connected = !1, this._resolved = !1, this._numberProps = null, this.shadowRoot && s ? s(this._createVNode(), this.shadowRoot) : (this.attachShadow({ mode: "open" }), this._def.__asyncLoader || this._resolveProps(this._def));
7088  }
7089  connectedCallback() {
7090    this._connected = !0, this._instance || (this._resolved ? this._update() : this._resolveDef());
7091  }
7092  disconnectedCallback() {
7093    this._connected = !1, yf(() => {
7094      this._connected || (_u(null, this.shadowRoot), this._instance = null);
7095    });
7096  }
7097  /**
7098   * resolve inner component definition (handle possible async component)
7099   */
7100  _resolveDef() {
7101    this._resolved = !0;
7102    for (let s = 0; s < this.attributes.length; s++)
7103      this._setAttr(this.attributes[s].name);
7104    new MutationObserver((s) => {
7105      for (const n of s)
7106        this._setAttr(n.attributeName);
7107    }).observe(this, { attributes: !0 });
7108    const t = (s, n = !1) => {
7109      const { props: r, styles: o } = s;
7110      let a;
7111      if (r && !it(r))
7112        for (const l in r) {
7113          const h = r[l];
7114          (h === Number || h && h.type === Number) && (l in this._props && (this._props[l] = zc(this._props[l])), (a || (a = /* @__PURE__ */ Object.create(null)))[mi(l)] = !0);
7115        }
7116      this._numberProps = a, n && this._resolveProps(s), this._applyStyles(o), this._update();
7117    }, i = this._def.__asyncLoader;
7118    i ? i().then((s) => t(s, !0)) : t(this._def);
7119  }
7120  _resolveProps(t) {
7121    const { props: i } = t, s = it(i) ? i : Object.keys(i || {});
7122    for (const n of Object.keys(this))
7123      n[0] !== "_" && s.includes(n) && this._setProp(n, this[n], !0, !1);
7124    for (const n of s.map(mi))
7125      Object.defineProperty(this, n, {
7126        get() {
7127          return this._getProp(n);
7128        },
7129        set(r) {
7130          this._setProp(n, r);
7131        }
7132      });
7133  }
7134  _setAttr(t) {
7135    let i = this.getAttribute(t);
7136    const s = mi(t);
7137    this._numberProps && this._numberProps[s] && (i = zc(i)), this._setProp(s, i, !1);
7138  }
7139  /**
7140   * @internal
7141   */
7142  _getProp(t) {
7143    return this._props[t];
7144  }
7145  /**
7146   * @internal
7147   */
7148  _setProp(t, i, s = !0, n = !0) {
7149    i !== this._props[t] && (this._props[t] = i, n && this._instance && this._update(), s && (i === !0 ? this.setAttribute(De(t), "") : typeof i == "string" || typeof i == "number" ? this.setAttribute(De(t), i + "") : i || this.removeAttribute(De(t))));
7150  }
7151  _update() {
7152    _u(this._createVNode(), this.shadowRoot);
7153  }
7154  _createVNode() {
7155    const t = Be(this._def, jt({}, this._props));
7156    return this._instance || (t.ce = (i) => {
7157      this._instance = i, i.isCE = !0;
7158      const s = (r, o) => {
7159        this.dispatchEvent(
7160          new CustomEvent(r, {
7161            detail: o
7162          })
7163        );
7164      };
7165      i.emit = (r, ...o) => {
7166        s(r, o), De(r) !== r && s(De(r), o);
7167      };
7168      let n = this;
7169      for (; n = n && (n.parentNode || n.host); )
7170        if (n instanceof Mh) {
7171          i.parent = n._instance, i.provides = n._instance.provides;
7172          break;
7173        }
7174    }), t;
7175  }
7176  _applyStyles(t) {
7177    t && t.forEach((i) => {
7178      const s = document.createElement("style");
7179      s.textContent = i, this.shadowRoot.appendChild(s);
7180    });
7181  }
7182}
7183const jv = ["ctrl", "shift", "alt", "meta"], Wv = {
7184  stop: (e) => e.stopPropagation(),
7185  prevent: (e) => e.preventDefault(),
7186  self: (e) => e.target !== e.currentTarget,
7187  ctrl: (e) => !e.ctrlKey,
7188  shift: (e) => !e.shiftKey,
7189  alt: (e) => !e.altKey,
7190  meta: (e) => !e.metaKey,
7191  left: (e) => "button" in e && e.button !== 0,
7192  middle: (e) => "button" in e && e.button !== 1,
7193  right: (e) => "button" in e && e.button !== 2,
7194  exact: (e, t) => jv.some((i) => e[`${i}Key`] && !t.includes(i))
7195}, Yf = (e, t) =>
7195 (i, ...s) => {
7196  for (let n = 0; n < t.length; n++) {
7197    const r = Wv[t[n]];
7198    if (r && r(i, t))
7199      return;
7200  }
7201  return e(i, ...s);
7202}, Bv = /* @__PURE__ */ jt({ patchProp: Nv }, Cv);
7203let gu;
7204function Uv() {
7205  return gu || (gu = iv(Bv));
7206}
7207const _u = (...e) => {
7208  Uv().render(...e);
7209};
7210function Fa(e) {
7211  return parseInt(e, 16) || e;
7212}
7213function ka(e) {
7214  return Fa(e) / 255 <= 0.03928 ? Fa(e) / 255 / 12.92 : Math.pow((Fa(e) / 255 + 0.055) / 1.055, 2.4);
7215}
7216function mu(e) {
7217  return 0.2126 * ka(e.substr(1, 2)) + 0.7152 * ka(e.substr(3, 2)) + 0.0722 * ka(e.substr(-2));
7218}
7219function Po(e, t) {
7220  const i = mu(e), s = mu(t);
7221  return (Math.max(i, s) + 0.05) / (Math.min(i, s) + 0.05);
7222}
7223function Xv(e) {
7224  const t = Po(e, "#ffffff"), i = Po(e, "#000000");
7225  return t > i ? "#ffffff" : "#000000";
7226}
7227function $v(e) {
7228  const t = Po(e, "#ffffff"), i = Po(e, "#000000");
7229  return t > i;
7230}
7231const Yv = `.xmap{height:100%;display:flex;flex-flow:column;font-family:Roboto,sans-serif!important;border:1px solid black}.xmap-main{height:calc(100% - 25px)}.xmap-web-map-footer{width:100%;height:25px;min-height:25px;background-color:var(--xmap-primary);font-size:.8em}.xmap-web-map-footer div{float:right;padding-right:5px;height:100%;line-height:25px}.xmap-web-map-footer div span{color:var(--xmap-footer-text);opacity:.9;height:100%;line-height:25px;padding-right:5px}.xmap-web-map-footer div a,.xmap-web-map-footer div a:hover,.xmap-web-map-footer div a:focus,.xmap-web-map-footer div a:active{text-decoration:none;color:var(--xmap-footer-text);float:right}
7232`, ca = (e, t) => {
7233  const i = e.__vccOpts || e;
7234  for (const [s, n] of t)
7235    i[s] = n;
7236  return i;
7237}, Kv = {
7238  name: "Xmap",
7239  mounted() {
7240  },
7241  data: () => ({
7242    allowedVariants: ["xmap", "parishonline"]
7243  }),
7244  computed: {
7245    footerTextColor() {
7246      return Xv(this.primaryColor);
7247    },
7248    logoType() {
7249      let e = $v(this.primaryColor) ? "light" : "dark";
7250      return `https://embed.xmap.cloud/${this.appVariant}-${e}.png`;
7251    },
7252    // Theme colours as named CSS custom properties, set through the normal :style
7253    // render path. Not v-bind() in <style>: Vue's useCssVars writes those from a
7254    // post-flush job that never lands in the Power Apps canvas player (XMP-2224).
7255    themeVars() {
7256      return {
7257        "--xmap-primary": this.primaryColor,
7258        "--xmap-secondary": this.secondaryColor,
7259        "--xmap-footer-text": this.footerTextColor
7260      };
7261    },
7262    appVariant() {
7263      return this.allowedVariants.includes(this.variant) ? this.variant : this.allowedVariants[0];
7264    }
7265  },
7266  provide() {
7267    return {
7268      primaryColor: this.primaryColor,
7269      secondaryColor: this.secondaryColor,
7270      variant: this.appVariant
7271    };
7272  },
7273  methods: {
7274    handleUpdate(e) {
7275    }
7276  },
7277  watch: {
7278    primaryColor(e) {
7279    }
7280  },
7281  props: {
7282    variant: {
7283      type: String,
7284      default: "xmap"
7285    },
7286    primaryColor: {
7287      type: String,
7288      default: "#263746"
7289    },
7290    secondaryColor: {
7291      type: String,
7292      default: "#a1d0ca"
7293    }
7294  }
7295}, qv = {
7296  ref: "xmapMain",
7297  class: "xmap-main"
7298}, Vv = {
7299  ref: "footer",
7300  class: "xmap-web-map-footer"
7301}, Hv = /* @__PURE__ */ Nt("span", null, "Powered by ", -1), Zv = {
7302  target: "_blank",
7303  href: "https://parish-online.co.uk"
7304}, Jv = ["src"];
7305function Qv(e, t, i, s, n, r) {
7306  return wt(), It("div", {
7307    class: "xmap",
7308    style: Pr(r.themeVars)
7309  }, [
7310    Nt("div", qv, [
7311      If(e.$slots, "default", {
7312        "onUpdate:x": t[0] || (t[0] = (...o) => r.handleUpdate && r.handleUpdate(...o))
7313      })
7314    ], 512),
7315    Nt("div", Vv, [
7316      Nt("div", null, [
7317        Hv,
7318        Nt("a", Zv, [
7319          Nt("img", {
7320            style: { height: "20px", "margin-top": "2.5px" },
7321            alt: "A Logo",
7322            src: `${r.logoType}`
7323          }, null, 8, Jv)
7324        ])
7325      ])
7326    ], 512)
7327  ], 4);
7328}
7329const tE = /* @__PURE__ */ ca(Kv, [["render", Qv], ["styles", [Yv]]]);
7330class eE {
7331  /**
7332   * @param {string} type Type.
7333   */
7334  constructor(t) {
7335    this.propagationStopped, this.defaultPrevented, this.type = t, this.target = null;
7336  }
7337  /**
7338   * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events
7339   * will be fired.
7340   * @api
7341   */
7342  preventDefault() {
7343    this.defaultPrevented = !0;
7344  }
7345  /**
7346   * Stop event propagation.
7347   * @api
7348   */
7349  stopPropagation() {
7350    this.propagationStopped = !0;
7351  }
7352}
7353const Ae = eE, En = {
7354  /**
7355   * Triggered when a property is changed.
7356   * @event module:ol/Object.ObjectEvent#propertychange
7357   * @api
7358   */
7359  PROPERTYCHANGE: "propertychange"
7360};
7361class iE {
7362  constructor() {
7363    this.disposed = !1;
7364  }
7365  /**
7366   * Clean up.
7367   */
7368  dispose() {
7369    this.disposed || (this.disposed = !0, this.disposeInternal());
7370  }
7371  /**
7372   * Extension point for disposable objects.
7373   * @protected
7374   */
7375  disposeInternal() {
7376  }
7377}
7378const Ch = iE;
7379function sE(e, t, i) {
7380  let s, n;
7381  i = i || ws;
7382  let r = 0, o = e.length, a = !1;
7383  for (; r < o; )
7384    s = r + (o - r >> 1), n = +i(e[s], t), n < 0 ? r = s + 1 : (o = s, a = !n);
7385  return a ? r : ~r;
7386}
7387function ws(e, t) {
7388  return e > t ? 1 : e < t ? -1 : 0;
7389}
7390function ua(e, t, i) {
7391  if (e[0] <= t)
7392    return 0;
7393  const s = e.length;
7394  if (t <= e[s - 1])
7395    return s - 1;
7396  if (typeof i == "function") {
7397    for (let n = 1; n < s; ++n) {
7398      const r = e[n];
7399      if (r === t)
7400        return n;
7401      if (r < t)
7402        return i(t, e[n - 1], r) > 0 ? n - 1 : n;
7403    }
7404    return s - 1;
7405  }
7406  if (i > 0) {
7407    for (let n = 1; n < s; ++n)
7408      if (e[n] < t)
7409        return n - 1;
7410    return s - 1;
7411  }
7412  if (i < 0) {
7413    for (let n = 1; n < s; ++n)
7414      if (e[n] <= t)
7415        return n;
7416    return s - 1;
7417  }
7418  for (let n = 1; n < s; ++n) {
7419    if (e[n] == t)
7420      return n;
7421    if (e[n] < t)
7422      return e[n - 1] - t < t - e[n] ? n - 1 : n;
7423  }
7424  return s - 1;
7425}
7426function nE(e, t, i) {
7427  for (; t < i; ) {
7428    const s = e[t];
7429    e[t] = e[i], e[i] = s, ++t, --i;
7430  }
7431}
7432function pi(e, t) {
7433  const i = Array.isArray(t) ? t : [t], s = i.length;
7434  for (let n = 0; n < s; n++)
7435    e[e.length] = i[n];
7436}
7437function wi(e, t) {
7438  const i = e.length;
7439  if (i !== t.length)
7440    return !1;
7441  for (let s = 0; s < i; s++)
7442    if (e[s] !== t[s])
7443      return !1;
7444  return !0;
7445}
7446function rE(e, t, i) {
7447  const s = t || ws;
7448  return e.every(function(n, r) {
7449    if (r === 0)
7450      return !0;
7451    const o = s(e[r - 1], n);
7452    return !(o > 0 || i && o === 0);
7453  });
7454}
7455function Ss() {
7456  return !0;
7457}
7458function As() {
7459  return !1;
7460}
7461function Mn() {
7462}
7463function oE(e) {
7464  let t = !1, i, s, n;
7465  return function() {
7466    const r = Array.prototype.slice.call(arguments);
7467    return (!t || this !== n || !wi(r, s)) && (t = !0, n = this, s = r, i = e.apply(this, arguments)), i;
7468  };
7469}
7470class aE extends Ch {
7471  /**
7472   * @param {*} [target] Default event target for dispatched events.
7473   */
7474  constructor(t) {
7475    super(), this.eventTarget_ = t, this.pendingRemovals_ = null, this.dispatching_ = null, this.listeners_ = null;
7476  }
7477  /**
7478   * @param {string} type Type.
7479   * @param {import("../events.js").Listener} listener Listener.
7480   */
7481  addEventListener(t, i) {
7482    if (!t || !i)
7483      return;
7484    const s = this.listeners_ || (this.listeners_ = {}), n = s[t] || (s[t] = []);
7485    n.includes(i) || n.push(i);
7486  }
7487  /**
7488   * Dispatches an event and calls all listeners listening for events
7489   * of this type. The event parameter can either be a string or an
7490   * Object with a `type` property.
7491   *
7492   * @param {import("./Event.js").default|string} event Event object.
7493   * @return {boolean|undefined} `false` if anyone called preventDefault on the
7494   *     event object or if any of the listeners returned false.
7495   * @api
7496   */
7497  dispatchEvent(t) {
7498    const i = typeof t == "string", s = i ? t : t.type, n = this.listeners_ && this.listeners_[s];
7499    if (!n)
7500      return;
7501    const r = i ? new Ae(t) : (
7502      /** @type {Event} */
7503      t
7504    );
7505    r.target || (r.target = this.eventTarget_ || this);
7506    const o = this.dispatching_ || (this.dispatching_ = {}), a = this.pendingRemovals_ || (this.pendingRemovals_ = {});
7507    s in o || (o[s] = 0, a[s] = 0), ++o[s];
7508    let l;
7509    for (let h = 0, c = n.length; h < c; ++h)
7510      if ("handleEvent" in n[h] ? l = /** @type {import("../events.js").ListenerObject} */
7511      n[h].handleEvent(r) : l = /** @type {import("../events.js").ListenerFunction} */
7512      n[h].call(this, r), l === !1 || r.propagationStopped) {
7513        l = !1;
7514        break;
7515      }
7516    if (--o[s] === 0) {
7517      let h = a[s];
7518      for (delete a[s]; h--; )
7519        this.removeEventListener(s, Mn);
7520      delete o[s];
7521    }
7522    return l;
7523  }
7524  /**
7525   * Clean up.
7526   */
7527  disposeInternal() {
7528    this.listeners_ && Tr(this.listeners_);
7529  }
7530  /**
7531   * Get the listeners for a specified event type. Listeners are returned in the
7532   * order that they will be called in.
7533   *
7534   * @param {string} type Type.
7535   * @return {Array<import("../events.js").Listener>|undefined} Listeners.
7536   */
7537  getListeners(t) {
7538    return this.listeners_ && this.listeners_[t] || void 0;
7539  }
7540  /**
7541   * @param {string} [type] Type. If not provided,
7542   *     `true` will be returned if this event target has any listeners.
7543   * @return {boolean} Has listeners.
7544   */
7545  hasListener(t) {
7546    return this.listeners_ ? t ? t in this.listeners_ : Object.keys(this.listeners_).length > 0 : !1;
7547  }
7548  /**
7549   * @param {string} type Type.
7550   * @param {import("../events.js").Listener} listener Listener.
7551   */
7552  removeEventListener(t, i) {
7553    const s = this.listeners_ && this.listeners_[t];
7554    if (s) {
7555      const n = s.indexOf(i);
7556      n !== -1 && (this.pendingRemovals_ && t in this.pendingRemovals_ ? (s[n] = Mn, ++this.pendingRemovals_[t]) : (s.splice(n, 1), s.length === 0 && delete this.listeners_[t]));
7557    }
7558  }
7559}
7560const Ar = aE, et = {
7561  /**
7562   * Generic change event. Triggered when the revision counter is increased.
7563   * @event module:ol/events/Event~BaseEvent#change
7564   * @api
7565   */
7566  CHANGE: "change",
7567  /**
7568   * Generic error event. Triggered when an error occurs.
7569   * @event module:ol/events/Event~BaseEvent#error
7570   * @api
7571   */
7572  ERROR: "error",
7573  BLUR: "blur",
7574  CLEAR: "clear",
7575  CONTEXTMENU: "contextmenu",
7576  CLICK: "click",
7577  DBLCLICK: "dblclick",
7578  DRAGENTER: "dragenter",
7579  DRAGOVER: "dragover",
7580  DROP: "drop",
7581  FOCUS: "focus",
7582  KEYDOWN: "keydown",
7583  KEYPRESS: "keypress",
7584  LOAD: "load",
7585  RESIZE: "resize",
7586  TOUCHMOVE: "touchmove",
7587  WHEEL: "wheel"
7588};
7589function lt(e, t, i, s, n) {
7590  if (s && s !== e && (i = i.bind(s)), n) {
7591    const o = i;
7592    i = function() {
7593      e.removeEventListener(t, i), o.apply(this, arguments);
7594    };
7595  }
7596  const r = {
7597    target: e,
7598    type: t,
7599    listener: i
7600  };
7601  return e.addEventListener(t, i), r;
7602}
7603function Ao(e, t, i, s) {
7604  return lt(e, t, i, s, !0);
7605}
7606function Mt(e) {
7607  e && e.target && (e.target.removeEventListener(e.type, e.listener), Tr(e));
7608}
7609class da extends Ar {
7610  constructor() {
7611    super(), this.on = /** @type {ObservableOnSignature<import("./events").EventsKey>} */
7612    this.onInternal, this.once = /** @type {ObservableOnSignature<import("./events").EventsKey>} */
7613    this.onceInternal, this.un = /** @type {ObservableOnSignature<void>} */
7614    this.unInternal, this.revision_ = 0;
7615  }
7616  /**
7617   * Increases the revision counter and dispatches a 'change' event.
7618   * @api
7619   */
7620  changed() {
7621    ++this.revision_, this.dispatchEvent(et.CHANGE);
7622  }
7623  /**
7624   * Get the version number for this object.  Each time the object is modified,
7625   * its version number will be incremented.
7626   * @return {number} Revision.
7627   * @api
7628   */
7629  getRevision() {
7630    return this.revision_;
7631  }
7632  /**
7633   * @param {string|Array<string>} type Type.
7634   * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
7635   * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
7636   * @protected
7637   */
7638  onInternal(t, i) {
7639    if (Array.isArray(t)) {
7640      const s = t.length, n = new Array(s);
7641      for (let r = 0; r < s; ++r)
7642        n[r] = lt(this, t[r], i);
7643      return n;
7644    }
7645    return lt(
7646      this,
7647      /** @type {string} */
7648      t,
7649      i
7650    );
7651  }
7652  /**
7653   * @param {string|Array<string>} type Type.
7654   * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
7655   * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key.
7656   * @protected
7657   */
7658  onceInternal(t, i) {
7659    let s;
7660    if (Array.isArray(t)) {
7661      const n = t.length;
7662      s = new Array(n);
7663      for (let r = 0; r < n; ++r)
7664        s[r] = Ao(this, t[r], i);
7665    } else
7666      s = Ao(
7667        this,
7668        /** @type {string} */
7669        t,
7670        i
7671      );
7672    return i.ol_key = s, s;
7673  }
7674  /**
7675   * Unlisten for a certain type of event.
7676   * @param {string|Array<string>} type Type.
7677   * @param {function((Event|import("./events/Event").default)): ?} listener Listener.
7678   * @protected
7679   */
7680  unInternal(t, i) {
7681    const s = (
7682      /** @type {Object} */
7683      i.ol_key
7684    );
7685    if (s)
7686      lE(s);
7687    else if (Array.isArray(t))
7688      for (let n = 0, r = t.length; n < r; ++n)
7689        this.removeEventListener(t[n], i);
7690    else
7691      this.removeEventListener(t, i);
7692  }
7693}
7694da.prototype.on;
7695da.prototype.once;
7696da.prototype.un;
7697function lE(e) {
7698  if (Array.isArray(e))
7699    for (let t = 0, i = e.length; t < i; ++t)
7700      Mt(e[t]);
7701  else
7702    Mt(
7703      /** @type {import("./events.js").EventsKey} */
7704      e
7705    );
7706}
7707const Kf = da;
7708function Z() {
7709  throw new Error("Unimplemented abstract method.");
7710}
7711let hE = 0;
7712function ot(e) {
7713  return e.ol_uid || (e.ol_uid = String(++hE));
7714}
7715class pu extends Ae {
7716  /**
7717   * @param {string} type The event type.
7718   * @param {string} key The property name.
7719   * @param {*} oldValue The old value for `key`.
7720   */
7721  constructor(t, i, s) {
7722    super(t), this.key = i, this.oldValue = s;
7723  }
7724}
7725class cE extends Kf {
7726  /**
7727   * @param {Object<string, *>} [values] An object with key-value pairs.
7728   */
7729  constructor(t) {
7730    super(), this.on, this.once, this.un, ot(this), this.values_ = null, t !== void 0 && this.setProperties(t);
7731  }
7732  /**
7733   * Gets a value.
7734   * @param {string} key Key name.
7735   * @return {*} Value.
7736   * @api
7737   */
7738  get(t) {
7739    let i;
7740    return this.values_ && this.values_.hasOwnProperty(t) && (i = this.values_[t]), i;
7741  }
7742  /**
7743   * Get a list of object property names.
7744   * @return {Array<string>} List of property names.
7745   * @api
7746   */
7747  getKeys() {
7748    return this.values_ && Object.keys(this.values_) || [];
7749  }
7750  /**
7751   * Get an object of all property names and values.
7752   * @return {Object<string, *>} Object.
7753   * @api
7754   */
7755  getProperties() {
7756    return this.values_ && Object.assign({}, this.values_) || {};
7757  }
7758  /**
7759   * @return {boolean} The object has properties.
7760   */
7761  hasProperties() {
7762    return !!this.values_;
7763  }
7764  /**
7765   * @param {string} key Key name.
7766   * @param {*} oldValue Old value.
7767   */
7768  notify(t, i) {
7769    let s;
7770    s = `change:${t}`, this.hasListener(s) && this.dispatchEvent(new pu(s, t, i)), s = En.PROPERTYCHANGE, this.hasListener(s) && this.dispatchEvent(new pu(s, t, i));
7771  }
7772  /**
7773   * @param {string} key Key name.
7774   * @param {import("./events.js").Listener} listener Listener.
7775   */
7776  addChangeListener(t, i) {
7777    this.addEventListener(`change:${t}`, i);
7778  }
7779  /**
7780   * @param {string} key Key name.
7781   * @param {import("./events.js").Listener} listener Listener.
7782   */
7783  removeChangeListener(t, i) {
7784    this.removeEventListener(`change:${t}`, i);
7785  }
7786  /**
7787   * Sets a value.
7788   * @param {string} key Key name.
7789   * @param {*} value Value.
7790   * @param {boolean} [silent] Update without triggering an event.
7791   * @api
7792   */
7793  set(t, i, s) {
7794    const n = this.values_ || (this.values_ = {});
7795    if (s)
7796      n[t] = i;
7797    else {
7798      const r = n[t];
7799      n[t] = i, r !== i && this.notify(t, r);
7800    }
7801  }
7802  /**
7803   * Sets a collection of key-value pairs.  Note that this changes any existing
7804   * properties and adds new ones (it does not remove any existing properties).
7805   * @param {Object<string, *>} values Values.
7806   * @param {boolean} [silent] Update without triggering an event.
7807   * @api
7808   */
7809  setProperties(t, i) {
7810    for (const s in t)
7811      this.set(s, t[s], i);
7812  }
7813  /**
7814   * Apply any properties from another object without triggering events.
7815   * @param {BaseObject} source The source object.
7816   * @protected
7817   */
7818  applyProperties(t) {
7819    t.values_ && Object.assign(this.values_ || (this.values_ = {}), t.values_);
7820  }
7821  /**
7822   * Unsets a property.
7823   * @param {string} key Key name.
7824   * @param {boolean} [silent] Unset without triggering an event.
7825   * @api
7826   */
7827  unset(t, i) {
7828    if (this.values_ && t in this.values_) {
7829      const s = this.values_[t];
7830      delete this.values_[t], _n(this.values_) && (this.values_ = null), i || this.notify(t, s);
7831    }
7832  }
7833}
7834const ni = cE, $t = {
7835  /**
7836   * Triggered when an item is added to the collection.
7837   * @event module:ol/Collection.CollectionEvent#add
7838   * @api
7839   */
7840  ADD: "add",
7841  /**
7842   * Triggered when an item is removed from the collection.
7843   * @event module:ol/Collection.CollectionEvent#remove
7844   * @api
7845   */
7846  REMOVE: "remove"
7847}, yu = {
7848  LENGTH: "length"
7849};
7850class Vr extends Ae {
7851  /**
7852   * @param {import("./CollectionEventType.js").default} type Type.
7853   * @param {T} element Element.
7854   * @param {number} index The index of the added or removed element.
7855   */
7856  constructor(t, i, s) {
7857    super(t), this.element = i, this.index = s;
7858  }
7859}
7860class uE extends ni {
7861  /**
7862   * @param {Array<T>} [array] Array.
7863   * @param {Options} [options] Collection options.
7864   */
7865  constructor(t, i) {
7866    if (super(), this.on, this.once, this.un, i = i || {}, this.unique_ = !!i.unique, this.array_ = t || [], this.unique_)
7867      for (let s = 0, n = this.array_.length; s < n; ++s)
7868        this.assertUnique_(this.array_[s], s);
7869    this.updateLength_();
7870  }
7871  /**
7872   * Remove all elements from the collection.
7873   * @api
7874   */
7875  clear() {
7876    for (; this.getLength() > 0; )
7877      this.pop();
7878  }
7879  /**
7880   * Add elements to the collection.  This pushes each item in the provided array
7881   * to the end of the collection.
7882   * @param {!Array<T>} arr Array.
7883   * @return {Collection<T>} This collection.
7884   * @api
7885   */
7886  extend(t) {
7887    for (let i = 0, s = t.length; i < s; ++i)
7888      this.push(t[i]);
7889    return this;
7890  }
7891  /**
7892   * Iterate over each element, calling the provided callback.
7893   * @param {function(T, number, Array<T>): *} f The function to call
7894   *     for every element. This function takes 3 arguments (the element, the
7895   *     index and the array). The return value is ignored.
7896   * @api
7897   */
7898  forEach(t) {
7899    const i = this.array_;
7900    for (let s = 0, n = i.length; s < n; ++s)
7901      t(i[s], s, i);
7902  }
7903  /**
7904   * Get a reference to the underlying Array object. Warning: if the array
7905   * is mutated, no events will be dispatched by the collection, and the
7906   * collection's "length" property won't be in sync with the actual length
7907   * of the array.
7908   * @return {!Array<T>} Array.
7909   * @api
7910   */
7911  getArray() {
7912    return this.array_;
7913  }
7914  /**
7915   * Get the element at the provided index.
7916   * @param {number} index Index.
7917   * @return {T} Element.
7918   * @api
7919   */
7920  item(t) {
7921    return this.array_[t];
7922  }
7923  /**
7924   * Get the length of this collection.
7925   * @return {number} The length of the array.
7926   * @observable
7927   * @api
7928   */
7929  getLength() {
7930    return this.get(yu.LENGTH);
7931  }
7932  /**
7933   * Insert an element at the provided index.
7934   * @param {number} index Index.
7935   * @param {T} elem Element.
7936   * @api
7937   */
7938  insertAt(t, i) {
7939    if (t < 0 || t > this.getLength())
7940      throw new Error("Index out of bounds: " + t);
7941    this.unique_ && this.assertUnique_(i), this.array_.splice(t, 0, i), this.updateLength_(), this.dispatchEvent(
7942      new Vr($t.ADD, i, t)
7943    );
7944  }
7945  /**
7946   * Remove the last element of the collection and return it.
7947   * Return `undefined` if the collection is empty.
7948   * @return {T|undefined} Element.
7949   * @api
7950   */
7951  pop() {
7952    return this.removeAt(this.getLength() - 1);
7953  }
7954  /**
7955   * Insert the provided element at the end of the collection.
7956   * @param {T} elem Element.
7957   * @return {number} New length of the collection.
7958   * @api
7959   */
7960  push(t) {
7961    this.unique_ && this.assertUnique_(t);
7962    const i = this.getLength();
7963    return this.insertAt(i, t), this.getLength();
7964  }
7965  /**
7966   * Remove the first occurrence of an element from the collection.
7967   * @param {T} elem Element.
7968   * @return {T|undefined} The removed element or undefined if none found.
7969   * @api
7970   */
7971  remove(t) {
7972    const i = this.array_;
7973    for (let s = 0, n = i.length; s < n; ++s)
7974      if (i[s] === t)
7975        return this.removeAt(s);
7976  }
7977  /**
7978   * Remove the element at the provided index and return it.
7979   * Return `undefined` if the collection does not contain this index.
7980   * @param {number} index Index.
7981   * @return {T|undefined} Value.
7982   * @api
7983   */
7984  removeAt(t) {
7985    if (t < 0 || t >= this.getLength())
7986      return;
7987    const i = this.array_[t];
7988    return this.array_.splice(t, 1), this.updateLength_(), this.dispatchEvent(
7989      /** @type {CollectionEvent<T>} */
7990      new Vr($t.REMOVE, i, t)
7991    ), i;
7992  }
7993  /**
7994   * Set the element at the provided index.
7995   * @param {number} index Index.
7996   * @param {T} elem Element.
7997   * @api
7998   */
7999  setAt(t, i) {
8000    const s = this.getLength();
8001    if (t >= s) {
8002      this.insertAt(t, i);
8003      return;
8004    }
8005    if (t < 0)
8006      throw new Error("Index out of bounds: " + t);
8007    this.unique_ && this.assertUnique_(i, t);
8008    const n = this.array_[t];
8009    this.array_[t] = i, this.dispatchEvent(
8010      /** @type {CollectionEvent<T>} */
8011      new Vr($t.REMOVE, n, t)
8012    ), this.dispatchEvent(
8013      /** @type {CollectionEvent<T>} */
8014      new Vr($t.ADD, i, t)
8015    );
8016  }
8017  /**
8018   * @private
8019   */
8020  updateLength_() {
8021    this.set(yu.LENGTH, this.array_.length);
8022  }
8023  /**
8024   * @private
8025   * @param {T} elem Element.
8026   * @param {number} [except] Optional index to ignore.
8027   */
8028  assertUnique_(t, i) {
8029    for (let s = 0, n = this.array_.length; s < n; ++s)
8030      if (this.array_[s] === t && s !== i)
8031        throw new Nd(58);
8032  }
8033}
8034const Pe = uE, ts = typeof navigator < "u" && typeof navigator.userAgent < "u" ? navigator.userAgent.toLowerCase() : "", dE = ts.includes("firefox"), fE = ts.includes("safari") && !ts.includes("chrom");
8035fE && (ts.includes("version/15.4") || /cpu (os|iphone os) 15_4 like mac os x/.test(ts));
8036const gE = ts.includes("webkit") && !ts.includes("edge"), _E = ts.includes("macintosh"), qf = typeof devicePixelRatio < "u" ? devicePixelRatio : 1, bh = typeof WorkerGlobalScope < "u" && typeof OffscreenCanvas < "u" && self instanceof WorkerGlobalScope, mE = typeof Image < "u" && Image.prototype.decode, Vf = function() {
8037  let e = !1;
8038  try {
8039    const t = Object.defineProperty({}, "passive", {
8040      get: function() {
8041        e = !0;
8042      }
8043    });
8044    window.addEventListener("_", null, t), window.removeEventListener("_", null, t);
8045  } catch {
8046  }
8047  return e;
8048}();
8049new Array(6);
8050function Qe() {
8051  return [1, 0, 0, 1, 0, 0];
8052}
8053function pE(e, t, i, s, n, r, o) {
8054  return e[0] = t, e[1] = i, e[2] = s, e[3] = n, e[4] = r, e[5] = o, e;
8055}
8056function yE(e, t) {
8057  return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e;
8058}
8059function zt(e, t) {
8060  const i = t[0], s = t[1];
8061  return t[0] = e[0] * i + e[2] * s + e[4], t[1] = e[1] * i + e[3] * s + e[5], t;
8062}
8063function xE(e, t, i) {
8064  return pE(e, t, 0, 0, i, 0, 0);
8065}
8066function si(e, t, i, s, n, r, o, a) {
8067  const l = Math.sin(r), h = Math.cos(r);
8068  return e[0] = s * h, e[1] = n * l, e[2] = -s * l, e[3] = n * h, e[4] = o * s * h - a * s * l + t, e[5] = o * n * l + a * n * h + i, e;
8069}
8070function fa(e, t) {
8071  const i = vE(t);
8072  at(i !== 0, 32);
8073  const s = t[0], n = t[1], r = t[2], o = t[3], a = t[4], l = t[5];
8074  return e[0] = o / i, e[1] = -n / i, e[2] = -r / i, e[3] = s / i, e[4] = (r * l - o * a) / i, e[5] = -(s * l - n * a) / i, e;
8075}
8076function vE(e) {
8077  return e[0] * e[3] - e[1] * e[2];
8078}
8079let xu;
8080function wh(e) {
8081  const t = "matrix(" + e.join(", ") + ")";
8082  if (bh)
8083    return t;
8084  const i = xu || (xu = document.createElement("div"));
8085  return i.style.transform = t, i.style.transform;
8086}
8087const EE = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i, ME = /^([a-z]*)$|^hsla?\(.*\)$/i;
8088function Hf(e) {
8089  return typeof e == "string" ? e : Zf(e);
8090}
8091function CE(e) {
8092  const t = document.createElement("div");
8093  if (t.style.color = e, t.style.color !== "") {
8094    document.body.appendChild(t);
8095    const i = getComputedStyle(t).color;
8096    return document.body.removeChild(t), i;
8097  }
8098  return "";
8099}
8100const bE = function() {
8101  const t = {};
8102  let i = 0;
8103  return (
8104    /**
8105     * @param {string} s String.
8106     * @return {Color} Color.
8107     */
8108    function(s) {
8109      let n;
8110      if (t.hasOwnProperty(s))
8111        n = t[s];
8112      else {
8113        if (i >= 1024) {
8114          let r = 0;
8115          for (const o in t)
8116            r++ & 3 || (delete t[o], --i);
8117        }
8118        n = wE(s), t[s] = n, ++i;
8119      }
8120      return n;
8121    }
8122  );
8123}();
8124function Lo(e) {
8125  return Array.isArray(e) ? e : bE(e);
8126}
8127function wE(e) {
8128  let t, i, s, n, r;
8129  if (ME.exec(e) && (e = CE(e)), EE.exec(e)) {
8130    const o = e.length - 1;
8131    let a;
8132    o <= 4 ? a = 1 : a = 2;
8133    const l = o === 4 || o === 8;
8134    t = parseInt(e.substr(1 + 0 * a, a), 16), i = parseInt(e.substr(1 + 1 * a, a), 16), s = parseInt(e.substr(1 + 2 * a, a), 16), l ? n = parseInt(e.substr(1 + 3 * a, a), 16) : n = 255, a == 1 && (t = (t << 4) + t, i = (i << 4) + i, s = (s << 4) + s, l && (n = (n << 4) + n)), r = [t, i, s, n / 255];
8135  } else
8136    e.startsWith("rgba(") ? (r = e.slice(5, -1).split(",").map(Number), vu(r)) : e.startsWith("rgb(") ? (r = e.slice(4, -1).split(",").map(Number), r.push(1), vu(r)) : at(!1, 14);
8137  return r;
8138}
8139function vu(e) {
8140  return e[0] = Ot(e[0] + 0.5 | 0, 0, 255), e[1] = Ot(e[1] + 0.5 | 0, 0, 255), e[2] = Ot(e[2] + 0.5 | 0, 0, 255), e[3] = Ot(e[3], 0, 1), e;
8141}
8142function Zf(e) {
8143  let t = e[0];
8144  t != (t | 0) && (t = t + 0.5 | 0);
8145  let i = e[1];
8146  i != (i | 0) && (i = i + 0.5 | 0);
8147  let s = e[2];
8148  s != (s | 0) && (s = s + 0.5 | 0);
8149  const n = e[3] === void 0 ? 1 : Math.round(e[3] * 100) / 100;
8150  return "rgba(" + t + "," + i + "," + s + "," + n + ")";
8151}
8152class SE {
8153  constructor() {
8154    this.cache_ = {}, this.cacheSize_ = 0, this.maxCacheSize_ = 32;
8155  }
8156  /**
8157   * FIXME empty description for jsdoc
8158   */
8159  clear() {
8160    this.cache_ = {}, this.cacheSize_ = 0;
8161  }
8162  /**
8163   * @return {boolean} Can expire cache.
8164   */
8165  canExpireCache() {
8166    return this.cacheSize_ > this.maxCacheSize_;
8167  }
8168  /**
8169   * FIXME empty description for jsdoc
8170   */
8171  expire() {
8172    if (this.canExpireCache()) {
8173      let t = 0;
8174      for (const i in this.cache_) {
8175        const s = this.cache_[i];
8176        !(t++ & 3) && !s.hasListener() && (delete this.cache_[i], --this.cacheSize_);
8177      }
8178    }
8179  }
8180  /**
8181   * @param {string} src Src.
8182   * @param {?string} crossOrigin Cross origin.
8183   * @param {import("../color.js").Color} color Color.
8184   * @return {import("./IconImage.js").default} Icon image.
8185   */
8186  get(t, i, s) {
8187    const n = Eu(t, i, s);
8188    return n in this.cache_ ? this.cache_[n] : null;
8189  }
8190  /**
8191   * @param {string} src Src.
8192   * @param {?string} crossOrigin Cross origin.
8193   * @param {import("../color.js").Color} color Color.
8194   * @param {import("./IconImage.js").default} iconImage Icon image.
8195   */
8196  set(t, i, s, n) {
8197    const r = Eu(t, i, s);
8198    this.cache_[r] = n, ++this.cacheSize_;
8199  }
8200  /**
8201   * Set the cache size of the icon cache. Default is `32`. Change this value when
8202   * your map uses more than 32 different icon images and you are not caching icon
8203   * styles on the application level.
8204   * @param {number} maxCacheSize Cache max size.
8205   * @api
8206   */
8207  setSize(t) {
8208    this.maxCacheSize_ = t, this.expire();
8209  }
8210}
8211function Eu(e, t, i) {
8212  const s = i ? Hf(i) : "null";
8213  return t + ":" + e + ":" + s;
8214}
8215const Oo = new SE(), Et = {
8216  OPACITY: "opacity",
8217  VISIBLE: "visible",
8218  EXTENT: "extent",
8219  Z_INDEX: "zIndex",
8220  MAX_RESOLUTION: "maxResolution",
8221  MIN_RESOLUTION: "minResolution",
8222  MAX_ZOOM: "maxZoom",
8223  MIN_ZOOM: "minZoom",
8224  SOURCE: "source",
8225  MAP: "map"
8226};
8227class TE extends ni {
8228  /**
8229   * @param {Options} options Layer options.
8230   */
8231  constructor(t) {
8232    super(), this.on, this.once, this.un, this.background_ = t.background;
8233    const i = Object.assign({}, t);
8234    typeof t.properties == "object" && (delete i.properties, Object.assign(i, t.properties)), i[Et.OPACITY] = t.opacity !== void 0 ? t.opacity : 1, at(typeof i[Et.OPACITY] == "number", 64), i[Et.VISIBLE] = t.visible !== void 0 ? t.visible : !0, i[Et.Z_INDEX] = t.zIndex, i[Et.MAX_RESOLUTION] = t.maxResolution !== void 0 ? t.maxResolution : 1 / 0, i[Et.MIN_RESOLUTION] = t.minResolution !== void 0 ? t.minResolution : 0, i[Et.MIN_ZOOM] = t.minZoom !== void 0 ? t.minZoom : -1 / 0, i[Et.MAX_ZOOM] = t.maxZoom !== void 0 ? t.maxZoom : 1 / 0, this.className_ = i.className !== void 0 ? i.className : "ol-layer", delete i.className, this.setProperties(i), this.state_ = null;
8235  }
8236  /**
8237   * Get the background for this layer.
8238   * @return {BackgroundColor|false} Layer background.
8239   */
8240  getBackground() {
8241    return this.background_;
8242  }
8243  /**
8244   * @return {string} CSS class name.
8245   */
8246  getClassName() {
8247    return this.className_;
8248  }
8249  /**
8250   * This method is not meant to be called by layers or layer renderers because the state
8251   * is incorrect if the layer is included in a layer group.
8252   *
8253   * @param {boolean} [managed] Layer is managed.
8254   * @return {import("./Layer.js").State} Layer state.
8255   */
8256  getLayerState(t) {
8257    const i = this.state_ || /** @type {?} */
8258    {
8259      layer: this,
8260      managed: t === void 0 ? !0 : t
8261    }, s = this.getZIndex();
8262    return i.opacity = Ot(Math.round(this.getOpacity() * 100) / 100, 0, 1), i.visible = this.getVisible(), i.extent = this.getExtent(), i.zIndex = s === void 0 && !i.managed ? 1 / 0 : s, i.maxResolution = this.getMaxResolution(), i.minResolution = Math.max(this.getMinResolution(), 0), i.minZoom = this.getMinZoom(), i.maxZoom = this.getMaxZoom(), this.state_ = i, i;
8263  }
8264  /**
8265   * @abstract
8266   * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be
8267   *     modified in place).
8268   * @return {Array<import("./Layer.js").default>} Array of layers.
8269   */
8270  getLayersArray(t) {
8271    return Z();
8272  }
8273  /**
8274   * @abstract
8275   * @param {Array<import("./Layer.js").State>} [states] Optional list of layer
8276   *     states (to be modified in place).
8277   * @return {Array<import("./Layer.js").State>} List of layer states.
8278   */
8279  getLayerStatesArray(t) {
8280    return Z();
8281  }
8282  /**
8283   * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
8284   * will be visible regardless of extent.
8285   * @return {import("../extent.js").Extent|undefined} The layer extent.
8286   * @observable
8287   * @api
8288   */
8289  getExtent() {
8290    return (
8291      /** @type {import("../extent.js").Extent|undefined} */
8292      this.get(Et.EXTENT)
8293    );
8294  }
8295  /**
8296   * Return the maximum resolution of the layer.
8297   * @return {number} The maximum resolution of the layer.
8298   * @observable
8299   * @api
8300   */
8301  getMaxResolution() {
8302    return (
8303      /** @type {number} */
8304      this.get(Et.MAX_RESOLUTION)
8305    );
8306  }
8307  /**
8308   * Return the minimum resolution of the layer.
8309   * @return {number} The minimum resolution of the layer.
8310   * @observable
8311   * @api
8312   */
8313  getMinResolution() {
8314    return (
8315      /** @type {number} */
8316      this.get(Et.MIN_RESOLUTION)
8317    );
8318  }
8319  /**
8320   * Return the minimum zoom level of the layer.
8321   * @return {number} The minimum zoom level of the layer.
8322   * @observable
8323   * @api
8324   */
8325  getMinZoom() {
8326    return (
8327      /** @type {number} */
8328      this.get(Et.MIN_ZOOM)
8329    );
8330  }
8331  /**
8332   * Return the maximum zoom level of the layer.
8333   * @return {number} The maximum zoom level of the layer.
8334   * @observable
8335   * @api
8336   */
8337  getMaxZoom() {
8338    return (
8339      /** @type {number} */
8340      this.get(Et.MAX_ZOOM)
8341    );
8342  }
8343  /**
8344   * Return the opacity of the layer (between 0 and 1).
8345   * @return {number} The opacity of the layer.
8346   * @observable
8347   * @api
8348   */
8349  getOpacity() {
8350    return (
8351      /** @type {number} */
8352      this.get(Et.OPACITY)
8353    );
8354  }
8355  /**
8356   * @abstract
8357   * @return {import("../source/Source.js").State} Source state.
8358   */
8359  getSourceState() {
8360    return Z();
8361  }
8362  /**
8363   * Return the value of this layer's `visible` property. To find out whether the layer
8364   * is visible on a map, use `isVisible()` instead.
8365   * @return {boolean} The value of the `visible` property of the layer.
8366   * @observable
8367   * @api
8368   */
8369  getVisible() {
8370    return (
8371      /** @type {boolean} */
8372      this.get(Et.VISIBLE)
8373    );
8374  }
8375  /**
8376   * Return the Z-index of the layer, which is used to order layers before
8377   * rendering. The default Z-index is 0.
8378   * @return {number} The Z-index of the layer.
8379   * @observable
8380   * @api
8381   */
8382  getZIndex() {
8383    return (
8384      /** @type {number} */
8385      this.get(Et.Z_INDEX)
8386    );
8387  }
8388  /**
8389   * Sets the background color.
8390   * @param {BackgroundColor} [background] Background color.
8391   */
8392  setBackground(t) {
8393    this.background_ = t, this.changed();
8394  }
8395  /**
8396   * Set the extent at which the layer is visible.  If `undefined`, the layer
8397   * will be visible at all extents.
8398   * @param {import("../extent.js").Extent|undefined} extent The extent of the layer.
8399   * @observable
8400   * @api
8401   */
8402  setExtent(t) {
8403    this.set(Et.EXTENT, t);
8404  }
8405  /**
8406   * Set the maximum resolution at which the layer is visible.
8407   * @param {number} maxResolution The maximum resolution of the layer.
8408   * @observable
8409   * @api
8410   */
8411  setMaxResolution(t) {
8412    this.set(Et.MAX_RESOLUTION, t);
8413  }
8414  /**
8415   * Set the minimum resolution at which the layer is visible.
8416   * @param {number} minResolution The minimum resolution of the layer.
8417   * @observable
8418   * @api
8419   */
8420  setMinResolution(t) {
8421    this.set(Et.MIN_RESOLUTION, t);
8422  }
8423  /**
8424   * Set the maximum zoom (exclusive) at which the layer is visible.
8425   * Note that the zoom levels for layer visibility are based on the
8426   * view zoom level, which may be different from a tile source zoom level.
8427   * @param {number} maxZoom The maximum zoom of the layer.
8428   * @observable
8429   * @api
8430   */
8431  setMaxZoom(t) {
8432    this.set(Et.MAX_ZOOM, t);
8433  }
8434  /**
8435   * Set the minimum zoom (inclusive) at which the layer is visible.
8436   * Note that the zoom levels for layer visibility are based on the
8437   * view zoom level, which may be different from a tile source zoom level.
8438   * @param {number} minZoom The minimum zoom of the layer.
8439   * @observable
8440   * @api
8441   */
8442  setMinZoom(t) {
8443    this.set(Et.MIN_ZOOM, t);
8444  }
8445  /**
8446   * Set the opacity of the layer, allowed values range from 0 to 1.
8447   * @param {number} opacity The opacity of the layer.
8448   * @observable
8449   * @api
8450   */
8451  setOpacity(t) {
8452    at(typeof t == "number", 64), this.set(Et.OPACITY, t);
8453  }
8454  /**
8455   * Set the visibility of the layer (`true` or `false`).
8456   * @param {boolean} visible The visibility of the layer.
8457   * @observable
8458   * @api
8459   */
8460  setVisible(t) {
8461    this.set(Et.VISIBLE, t);
8462  }
8463  /**
8464   * Set Z-index of the layer, which is used to order layers before rendering.
8465   * The default Z-index is 0.
8466   * @param {number} zindex The z-index of the layer.
8467   * @observable
8468   * @api
8469   */
8470  setZIndex(t) {
8471    this.set(Et.Z_INDEX, t);
8472  }
8473  /**
8474   * Clean up.
8475   */
8476  disposeInternal() {
8477    this.state_ && (this.state_.layer = null, this.state_ = null), super.disposeInternal();
8478  }
8479}
8480const Jf = TE, Vi = {
8481  /**
8482   * Triggered before a layer is rendered.
8483   * @event module:ol/render/Event~RenderEvent#prerender
8484   * @api
8485   */
8486  PRERENDER: "prerender",
8487  /**
8488   * Triggered after a layer is rendered.
8489   * @event module:ol/render/Event~RenderEvent#postrender
8490   * @api
8491   */
8492  POSTRENDER: "postrender",
8493  /**
8494   * Triggered before layers are composed.  When dispatched by the map, the event object will not have
8495   * a `context` set.  When dispatched by a layer, the event object will have a `context` set.  Only
8496   * WebGL layers currently dispatch this event.
8497   * @event module:ol/render/Event~RenderEvent#precompose
8498   * @api
8499   */
8500  PRECOMPOSE: "precompose",
8501  /**
8502   * Triggered after layers are composed.  When dispatched by the map, the event object will not have
8503   * a `context` set.  When dispatched by a layer, the event object will have a `context` set.  Only
8504   * WebGL layers currently dispatch this event.
8505   * @event module:ol/render/Event~RenderEvent#postcompose
8506   * @api
8507   */
8508  POSTCOMPOSE: "postcompose",
8509  /**
8510   * Triggered when rendering is complete, i.e. all sources and tiles have
8511   * finished loading for the current viewport, and all tiles are faded in.
8512   * The event object will not have a `context` set.
8513   * @event module:ol/render/Event~RenderEvent#rendercomplete
8514   * @api
8515   */
8516  RENDERCOMPLETE: "rendercomplete"
8517}, Xt = {
8518  ANIMATING: 0,
8519  INTERACTING: 1
8520}, Le = {
8521  CENTER: "center",
8522  RESOLUTION: "resolution",
8523  ROTATION: "rotation"
8524}, RE = 42, Sh = 256;
8525function Mu(e, t, i) {
8526  return (
8527    /**
8528     * @param {import("./coordinate.js").Coordinate|undefined} center Center.
8529     * @param {number|undefined} resolution Resolution.
8530     * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified.
8531     * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8532     * @param {Array<number>} [centerShift] Shift between map center and viewport center.
8533     * @return {import("./coordinate.js").Coordinate|undefined} Center.
8534     */
8535    function(s, n, r, o, a) {
8536      if (!s)
8537        return;
8538      if (!n && !t)
8539        return s;
8540      const l = t ? 0 : r[0] * n, h = t ? 0 : r[1] * n, c = a ? a[0] : 0, u = a ? a[1] : 0;
8541      let d = e[0] + l / 2 + c, f = e[2] - l / 2 + c, g = e[1] + h / 2 + u, _ = e[3] - h / 2 + u;
8542      d > f && (d = (f + d) / 2, f = d), g > _ && (g = (_ + g) / 2, _ = g);
8543      let m = Ot(s[0], d, f), p = Ot(s[1], g, _);
8544      if (o && i && n) {
8545        const y = 30 * n;
8546        m += -y * Math.log(1 + Math.max(0, d - s[0]) / y) + y * Math.log(1 + Math.max(0, s[0] - f) / y), p += -y * Math.log(1 + Math.max(0, g - s[1]) / y) + y * Math.log(1 + Math.max(0, s[1] - _) / y);
8547      }
8548      return [m, p];
8549    }
8550  );
8551}
8552function IE(e) {
8553  return e;
8554}
8555function Th(e, t, i, s) {
8556  const n = mt(t) / i[0], r = Yt(t) / i[1];
8557  return s ? Math.min(e, Math.max(n, r)) : Math.min(e, Math.min(n, r));
8558}
8559function Rh(e, t, i) {
8560  let s = Math.min(e, t);
8561  const n = 50;
8562  return s *= Math.log(1 + n * Math.max(0, e / t - 1)) / n + 1, i && (s = Math.max(s, i), s /= Math.log(1 + n * Math.max(0, i / e - 1)) / n + 1), Ot(s, i / 2, t * 2);
8563}
8564function PE(e, t, i, s) {
8565  return t = t !== void 0 ? t : !0, /**
8566   * @param {number|undefined} resolution Resolution.
8567   * @param {number} direction Direction.
8568   * @param {import("./size.js").Size} size Viewport size.
8569   * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8570   * @return {number|undefined} Resolution.
8571   */
8572  function(n, r, o, a) {
8573    if (n !== void 0) {
8574      const l = e[0], h = e[e.length - 1], c = i ? Th(
8575        l,
8576        i,
8577        o,
8578        s
8579      ) : l;
8580      if (a)
8581        return t ? Rh(
8582          n,
8583          c,
8584          h
8585        ) : Ot(n, h, c);
8586      const u = Math.min(c, n), d = Math.floor(ua(e, u, r));
8587      return e[d] > c && d < e.length - 1 ? e[d + 1] : e[d];
8588    }
8589  };
8590}
8591function AE(e, t, i, s, n, r) {
8592  return s = s !== void 0 ? s : !0, i = i !== void 0 ? i : 0, /**
8593   * @param {number|undefined} resolution Resolution.
8594   * @param {number} direction Direction.
8595   * @param {import("./size.js").Size} size Viewport size.
8596   * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8597   * @return {number|undefined} Resolution.
8598   */
8599  function(o, a, l, h) {
8600    if (o !== void 0) {
8601      const c = n ? Th(
8602        t,
8603        n,
8604        l,
8605        r
8606      ) : t;
8607      if (h)
8608        return s ? Rh(
8609          o,
8610          c,
8611          i
8612        ) : Ot(o, i, c);
8613      const u = 1e-9, d = Math.ceil(
8614        Math.log(t / c) / Math.log(e) - u
8615      ), f = -a * (0.5 - u) + 0.5, g = Math.min(c, o), _ = Math.floor(
8616        Math.log(t / g) / Math.log(e) + f
8617      ), m = Math.max(d, _), p = t / Math.pow(e, m);
8618      return Ot(p, i, c);
8619    }
8620  };
8621}
8622function Cu(e, t, i, s, n) {
8623  return i = i !== void 0 ? i : !0, /**
8624   * @param {number|undefined} resolution Resolution.
8625   * @param {number} direction Direction.
8626   * @param {import("./size.js").Size} size Viewport size.
8627   * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8628   * @return {number|undefined} Resolution.
8629   */
8630  function(r, o, a, l) {
8631    if (r !== void 0) {
8632      const h = s ? Th(
8633        e,
8634        s,
8635        a,
8636        n
8637      ) : e;
8638      return !i || !l ? Ot(r, t, h) : Rh(
8639        r,
8640        h,
8641        t
8642      );
8643    }
8644  };
8645}
8646function Ih(e) {
8647  if (e !== void 0)
8648    return 0;
8649}
8650function bu(e) {
8651  if (e !== void 0)
8652    return e;
8653}
8654function LE(e) {
8655  const t = 2 * Math.PI / e;
8656  return (
8657    /**
8658     * @param {number|undefined} rotation Rotation.
8659     * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8660     * @return {number|undefined} Rotation.
8661     */
8662    function(i, s) {
8663      if (s)
8664        return i;
8665      if (i !== void 0)
8666        return i = Math.floor(i / t + 0.5) * t, i;
8667    }
8668  );
8669}
8670function OE(e) {
8671  return e = e || _o(5), /**
8672   * @param {number|undefined} rotation Rotation.
8673   * @param {boolean} [isMoving] True if an interaction or animation is in progress.
8674   * @return {number|undefined} Rotation.
8675   */
8676  function(t, i) {
8677    if (i)
8678      return t;
8679    if (t !== void 0)
8680      return Math.abs(t) <= e ? 0 : t;
8681  };
8682}
8683function Qf(e) {
8684  return Math.pow(e, 3);
8685}
8686function Pn(e) {
8687  return 1 - Qf(1 - e);
8688}
8689function FE(e) {
8690  return 3 * e * e - 2 * e * e * e;
8691}
8692function kE(e) {
8693  return e;
8694}
8695function ps(e, t, i, s, n, r) {
8696  r = r || [];
8697  let o = 0;
8698  for (let a = t; a < i; a += s) {
8699    const l = e[a], h = e[a + 1];
8700    r[o++] = n[0] * l + n[2] * h + n[4], r[o++] = n[1] * l + n[3] * h + n[5];
8701  }
8702  return r && r.length != o && (r.length = o), r;
8703}
8704function Ph(e, t, i, s, n, r, o) {
8705  o = o || [];
8706  const a = Math.cos(n), l = Math.sin(n), h = r[0], c = r[1];
8707  let u = 0;
8708  for (let d = t; d < i; d += s) {
8709    const f = e[d] - h, g = e[d + 1] - c;
8710    o[u++] = h + f * a - g * l, o[u++] = c + f * l + g * a;
8711    for (let _ = d + 2; _ < d + s; ++_)
8712      o[u++] = e[_];
8713  }
8714  return o && o.length != u && (o.length = u), o;
8715}
8716function DE(e, t, i, s, n, r, o, a) {
8717  a = a || [];
8718  const l = o[0], h = o[1];
8719  let c = 0;
8720  for (let u = t; u < i; u += s) {
8721    const d = e[u] - l, f = e[u + 1] - h;
8722    a[c++] = l + n * d, a[c++] = h + r * f;
8723    for (let g = u + 2; g < u + s; ++g)
8724      a[c++] = e[g];
8725  }
8726  return a && a.length != c && (a.length = c), a;
8727}
8728function NE(e, t, i, s, n, r, o) {
8729  o = o || [];
8730  let a = 0;
8731  for (let l = t; l < i; l += s) {
8732    o[a++] = e[l] + n, o[a++] = e[l + 1] + r;
8733    for (let h = l + 2; h < l + s; ++h)
8734      o[a++] = e[h];
8735  }
8736  return o && o.length != a && (o.length = a), o;
8737}
8738const wu = Qe();
8739class GE extends ni {
8740  constructor() {
8741    super(), this.extent_ = ve(), this.extentRevision_ = -1, this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = 0, this.simplifyTransformedInternal = oE(function(t, i, s) {
8742      if (!s)
8743        return this.getSimplifiedGeometry(i);
8744      const n = this.clone();
8745      return n.applyTransform(s), n.getSimplifiedGeometry(i);
8746    });
8747  }
8748  /**
8749   * Get a transformed and simplified version of the geometry.
8750   * @abstract
8751   * @param {number} squaredTolerance Squared tolerance.
8752   * @param {import("../proj.js").TransformFunction} [transform] Optional transform function.
8753   * @return {Geometry} Simplified geometry.
8754   */
8755  simplifyTransformed(t, i) {
8756    return this.simplifyTransformedInternal(
8757      this.getRevision(),
8758      t,
8759      i
8760    );
8761  }
8762  /**
8763   * Make a complete copy of the geometry.
8764   * @abstract
8765   * @return {!Geometry} Clone.
8766   */
8767  clone() {
8768    return Z();
8769  }
8770  /**
8771   * @abstract
8772   * @param {number} x X.
8773   * @param {number} y Y.
8774   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
8775   * @param {number} minSquaredDistance Minimum squared distance.
8776   * @return {number} Minimum squared distance.
8777   */
8778  closestPointXY(t, i, s, n) {
8779    return Z();
8780  }
8781  /**
8782   * @param {number} x X.
8783   * @param {number} y Y.
8784   * @return {boolean} Contains (x, y).
8785   */
8786  containsXY(t, i) {
8787    const s = this.getClosestPoint([t, i]);
8788    return s[0] === t && s[1] === i;
8789  }
8790  /**
8791   * Return the closest point of the geometry to the passed point as
8792   * {@link module:ol/coordinate~Coordinate coordinate}.
8793   * @param {import("../coordinate.js").Coordinate} point Point.
8794   * @param {import("../coordinate.js").Coordinate} [closestPoint] Closest point.
8795   * @return {import("../coordinate.js").Coordinate} Closest point.
8796   * @api
8797   */
8798  getClosestPoint(t, i) {
8799    return i = i || [NaN, NaN], this.closestPointXY(t[0], t[1], i, 1 / 0), i;
8800  }
8801  /**
8802   * Returns true if this geometry includes the specified coordinate. If the
8803   * coordinate is on the boundary of the geometry, returns false.
8804   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
8805   * @return {boolean} Contains coordinate.
8806   * @api
8807   */
8808  intersectsCoordinate(t) {
8809    return this.containsXY(t[0], t[1]);
8810  }
8811  /**
8812   * @abstract
8813   * @param {import("../extent.js").Extent} extent Extent.
8814   * @protected
8815   * @return {import("../extent.js").Extent} extent Extent.
8816   */
8817  computeExtent(t) {
8818    return Z();
8819  }
8820  /**
8821   * Get the extent of the geometry.
8822   * @param {import("../extent.js").Extent} [extent] Extent.
8823   * @return {import("../extent.js").Extent} extent Extent.
8824   * @api
8825   */
8826  getExtent(t) {
8827    if (this.extentRevision_ != this.getRevision()) {
8828      const i = this.computeExtent(this.extent_);
8829      (isNaN(i[0]) || isNaN(i[1])) && Tn(i), this.extentRevision_ = this.getRevision();
8830    }
8831    return t1(this.extent_, t);
8832  }
8833  /**
8834   * Rotate the geometry around a given coordinate. This modifies the geometry
8835   * coordinates in place.
8836   * @abstract
8837   * @param {number} angle Rotation angle in radians.
8838   * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
8839   * @api
8840   */
8841  rotate(t, i) {
8842    Z();
8843  }
8844  /**
8845   * Scale the geometry (with an optional origin).  This modifies the geometry
8846   * coordinates in place.
8847   * @abstract
8848   * @param {number} sx The scaling factor in the x-direction.
8849   * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
8850   * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
8851   *     of the geometry extent).
8852   * @api
8853   */
8854  scale(t, i, s) {
8855    Z();
8856  }
8857  /**
8858   * Create a simplified version of this geometry.  For linestrings, this uses
8859   * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)
8860   * algorithm.  For polygons, a quantization-based
8861   * simplification is used to preserve topology.
8862   * @param {number} tolerance The tolerance distance for simplification.
8863   * @return {Geometry} A new, simplified version of the original geometry.
8864   * @api
8865   */
8866  simplify(t) {
8867    return this.getSimplifiedGeometry(t * t);
8868  }
8869  /**
8870   * Create a simplified version of this geometry using the Douglas Peucker
8871   * algorithm.
8872   * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
8873   * @abstract
8874   * @param {number} squaredTolerance Squared tolerance.
8875   * @return {Geometry} Simplified geometry.
8876   */
8877  getSimplifiedGeometry(t) {
8878    return Z();
8879  }
8880  /**
8881   * Get the type of this geometry.
8882   * @abstract
8883   * @return {Type} Geometry type.
8884   */
8885  getType() {
8886    return Z();
8887  }
8888  /**
8889   * Apply a transform function to the coordinates of the geometry.
8890   * The geometry is modified in place.
8891   * If you do not want the geometry modified in place, first `clone()` it and
8892   * then use this function on the clone.
8893   * @abstract
8894   * @param {import("../proj.js").TransformFunction} transformFn Transform function.
8895   * Called with a flat array of geometry coordinates.
8896   */
8897  applyTransform(t) {
8898    Z();
8899  }
8900  /**
8901   * Test if the geometry and the passed extent intersect.
8902   * @abstract
8903   * @param {import("../extent.js").Extent} extent Extent.
8904   * @return {boolean} `true` if the geometry and the extent intersect.
8905   */
8906  intersectsExtent(t) {
8907    return Z();
8908  }
8909  /**
8910   * Translate the geometry.  This modifies the geometry coordinates in place.  If
8911   * instead you want a new geometry, first `clone()` this geometry.
8912   * @abstract
8913   * @param {number} deltaX Delta X.
8914   * @param {number} deltaY Delta Y.
8915   * @api
8916   */
8917  translate(t, i) {
8918    Z();
8919  }
8920  /**
8921   * Transform each coordinate of the geometry from one coordinate reference
8922   * system to another. The geometry is modified in place.
8923   * For example, a line will be transformed to a line and a circle to a circle.
8924   * If you do not want the geometry modified in place, first `clone()` it and
8925   * then use this function on the clone.
8926   *
8927   * @param {import("../proj.js").ProjectionLike} source The current projection.  Can be a
8928   *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
8929   * @param {import("../proj.js").ProjectionLike} destination The desired projection.  Can be a
8930   *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
8931   * @return {Geometry} This geometry.  Note that original geometry is
8932   *     modified in place.
8933   * @api
8934   */
8935  transform(t, i) {
8936    const s = Rt(t), n = s.getUnits() == "tile-pixels" ? function(r, o, a) {
8937      const l = s.getExtent(), h = s.getWorldExtent(), c = Yt(h) / Yt(l);
8938      return si(
8939        wu,
8940        h[0],
8941        h[3],
8942        c,
8943        -c,
8944        0,
8945        0,
8946        0
8947      ), ps(
8948        r,
8949        0,
8950        r.length,
8951        a,
8952        wu,
8953        o
8954      ), nr(s, i)(
8955        r,
8956        o,
8957        a
8958      );
8959    } : nr(s, i);
8960    return this.applyTransform(n), this;
8961  }
8962}
8963const tg = GE;
8964class es extends tg {
8965  constructor() {
8966    super(), this.layout = "XY", this.stride = 2, this.flatCoordinates = null;
8967  }
8968  /**
8969   * @param {import("../extent.js").Extent} extent Extent.
8970   * @protected
8971   * @return {import("../extent.js").Extent} extent Extent.
8972   */
8973  computeExtent(t) {
8974    return zd(
8975      this.flatCoordinates,
8976      0,
8977      this.flatCoordinates.length,
8978      this.stride,
8979      t
8980    );
8981  }
8982  /**
8983   * @abstract
8984   * @return {Array<*> | null} Coordinates.
8985   */
8986  getCoordinates() {
8987    return Z();
8988  }
8989  /**
8990   * Return the first coordinate of the geometry.
8991   * @return {import("../coordinate.js").Coordinate} First coordinate.
8992   * @api
8993   */
8994  getFirstCoordinate() {
8995    return this.flatCoordinates.slice(0, this.stride);
8996  }
8997  /**
8998   * @return {Array<number>} Flat coordinates.
8999   */
9000  getFlatCoordinates() {
9001    return this.flatCoordinates;
9002  }
9003  /**
9004   * Return the last coordinate of the geometry.
9005   * @return {import("../coordinate.js").Coordinate} Last point.
9006   * @api
9007   */
9008  getLastCoordinate() {
9009    return this.flatCoordinates.slice(
9010      this.flatCoordinates.length - this.stride
9011    );
9012  }
9013  /**
9014   * Return the {@link import("./Geometry.js").GeometryLayout layout} of the geometry.
9015   * @return {import("./Geometry.js").GeometryLayout} Layout.
9016   * @api
9017   */
9018  getLayout() {
9019    return this.layout;
9020  }
9021  /**
9022   * Create a simplified version of this geometry using the Douglas Peucker algorithm.
9023   * @param {number} squaredTolerance Squared tolerance.
9024   * @return {SimpleGeometry} Simplified geometry.
9025   */
9026  getSimplifiedGeometry(t) {
9027    if (this.simplifiedGeometryRevision !== this.getRevision() && (this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = this.getRevision()), t 
9027< 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && t <= this.simplifiedGeometryMaxMinSquaredTolerance)
9028      return this;
9029    const i = this.getSimplifiedGeometryInternal(t);
9030    return i.getFlatCoordinates().length < this.flatCoordinates.length ? i : (this.simplifiedGeometryMaxMinSquaredTolerance = t, this);
9031  }
9032  /**
9033   * @param {number} squaredTolerance Squared tolerance.
9034   * @return {SimpleGeometry} Simplified geometry.
9035   * @protected
9036   */
9037  getSimplifiedGeometryInternal(t) {
9038    return this;
9039  }
9040  /**
9041   * @return {number} Stride.
9042   */
9043  getStride() {
9044    return this.stride;
9045  }
9046  /**
9047   * @param {import("./Geometry.js").GeometryLayout} layout Layout.
9048   * @param {Array<number>} flatCoordinates Flat coordinates.
9049   */
9050  setFlatCoordinates(t, i) {
9051    this.stride = Fo(t), this.layout = t, this.flatCoordinates = i;
9052  }
9053  /**
9054   * @abstract
9055   * @param {!Array<*>} coordinates Coordinates.
9056   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
9057   */
9058  setCoordinates(t, i) {
9059    Z();
9060  }
9061  /**
9062   * @param {import("./Geometry.js").GeometryLayout|undefined} layout Layout.
9063   * @param {Array<*>} coordinates Coordinates.
9064   * @param {number} nesting Nesting.
9065   * @protected
9066   */
9067  setLayout(t, i, s) {
9068    let n;
9069    if (t)
9070      n = Fo(t);
9071    else {
9072      for (let r = 0; r < s; ++r) {
9073        if (i.length === 0) {
9074          this.layout = "XY", this.stride = 2;
9075          return;
9076        }
9077        i = /** @type {Array} */
9078        i[0];
9079      }
9080      n = i.length, t = zE(n);
9081    }
9082    this.layout = t, this.stride = n;
9083  }
9084  /**
9085   * Apply a transform function to the coordinates of the geometry.
9086   * The geometry is modified in place.
9087   * If you do not want the geometry modified in place, first `clone()` it and
9088   * then use this function on the clone.
9089   * @param {import("../proj.js").TransformFunction} transformFn Transform function.
9090   * Called with a flat array of geometry coordinates.
9091   * @api
9092   */
9093  applyTransform(t) {
9094    this.flatCoordinates && (t(this.flatCoordinates, this.flatCoordinates, this.stride), this.changed());
9095  }
9096  /**
9097   * Rotate the geometry around a given coordinate. This modifies the geometry
9098   * coordinates in place.
9099   * @param {number} angle Rotation angle in counter-clockwise radians.
9100   * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
9101   * @api
9102   */
9103  rotate(t, i) {
9104    const s = this.getFlatCoordinates();
9105    if (s) {
9106      const n = this.getStride();
9107      Ph(
9108        s,
9109        0,
9110        s.length,
9111        n,
9112        t,
9113        i,
9114        s
9115      ), this.changed();
9116    }
9117  }
9118  /**
9119   * Scale the geometry (with an optional origin).  This modifies the geometry
9120   * coordinates in place.
9121   * @param {number} sx The scaling factor in the x-direction.
9122   * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
9123   * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
9124   *     of the geometry extent).
9125   * @api
9126   */
9127  scale(t, i, s) {
9128    i === void 0 && (i = t), s || (s = ii(this.getExtent()));
9129    const n = this.getFlatCoordinates();
9130    if (n) {
9131      const r = this.getStride();
9132      DE(
9133        n,
9134        0,
9135        n.length,
9136        r,
9137        t,
9138        i,
9139        s,
9140        n
9141      ), this.changed();
9142    }
9143  }
9144  /**
9145   * Translate the geometry.  This modifies the geometry coordinates in place.  If
9146   * instead you want a new geometry, first `clone()` this geometry.
9147   * @param {number} deltaX Delta X.
9148   * @param {number} deltaY Delta Y.
9149   * @api
9150   */
9151  translate(t, i) {
9152    const s = this.getFlatCoordinates();
9153    if (s) {
9154      const n = this.getStride();
9155      NE(
9156        s,
9157        0,
9158        s.length,
9159        n,
9160        t,
9161        i,
9162        s
9163      ), this.changed();
9164    }
9165  }
9166}
9167function zE(e) {
9168  let t;
9169  return e == 2 ? t = "XY" : e == 3 ? t = "XYZ" : e == 4 && (t = "XYZM"), /** @type {import("./Geometry.js").GeometryLayout} */
9170  t;
9171}
9172function Fo(e) {
9173  let t;
9174  return e == "XY" ? t = 2 : e == "XYZ" || e == "XYM" ? t = 3 : e == "XYZM" && (t = 4), /** @type {number} */
9175  t;
9176}
9177function jE(e, t, i) {
9178  const s = e.getFlatCoordinates();
9179  if (!s)
9180    return null;
9181  const n = e.getStride();
9182  return ps(
9183    s,
9184    0,
9185    s.length,
9186    n,
9187    t,
9188    i
9189  );
9190}
9191function Su(e, t, i, s, n, r, o) {
9192  const a = e[t], l = e[t + 1], h = e[i] - a, c = e[i + 1] - l;
9193  let u;
9194  if (h === 0 && c === 0)
9195    u = t;
9196  else {
9197    const d = ((n - a) * h + (r - l) * c) / (h * h + c * c);
9198    if (d > 1)
9199      u = i;
9200    else if (d > 0) {
9201      for (let f = 0; f < s; ++f)
9202        o[f] = Se(
9203          e[t + f],
9204          e[i + f],
9205          d
9206        );
9207      o.length = s;
9208      return;
9209    } else
9210      u = t;
9211  }
9212  for (let d = 0; d < s; ++d)
9213    o[d] = e[u + d];
9214  o.length = s;
9215}
9216function Ah(e, t, i, s, n) {
9217  let r = e[t], o = e[t + 1];
9218  for (t += s; t < i; t += s) {
9219    const a = e[t], l = e[t + 1], h = gi(r, o, a, l);
9220    h > n && (n = h), r = a, o = l;
9221  }
9222  return n;
9223}
9224function Lh(e, t, i, s, n) {
9225  for (let r = 0, o = i.length; r < o; ++r) {
9226    const a = i[r];
9227    n = Ah(e, t, a, s, n), t = a;
9228  }
9229  return n;
9230}
9231function WE(e, t, i, s, n) {
9232  for (let r = 0, o = i.length; r < o; ++r) {
9233    const a = i[r];
9234    n = Lh(e, t, a, s, n), t = a[a.length - 1];
9235  }
9236  return n;
9237}
9238function Oh(e, t, i, s, n, r, o, a, l, h, c) {
9239  if (t == i)
9240    return h;
9241  let u, d;
9242  if (n === 0) {
9243    if (d = gi(
9244      o,
9245      a,
9246      e[t],
9247      e[t + 1]
9248    ), d < h) {
9249      for (u = 0; u < s; ++u)
9250        l[u] = e[t + u];
9251      return l.length = s, d;
9252    }
9253    return h;
9254  }
9255  c = c || [NaN, NaN];
9256  let f = t + s;
9257  for (; f < i; )
9258    if (Su(
9259      e,
9260      f - s,
9261      f,
9262      s,
9263      o,
9264      a,
9265      c
9266    ), d = gi(o, a, c[0], c[1]), d < h) {
9267      for (h = d, u = 0; u < s; ++u)
9268        l[u] = c[u];
9269      l.length = s, f += s;
9270    } else
9271      f += s * Math.max(
9272        (Math.sqrt(d) - Math.sqrt(h)) / n | 0,
9273        1
9274      );
9275  if (r && (Su(
9276    e,
9277    i - s,
9278    t,
9279    s,
9280    o,
9281    a,
9282    c
9283  ), d = gi(o, a, c[0], c[1]), d < h)) {
9284    for (h = d, u = 0; u < s; ++u)
9285      l[u] = c[u];
9286    l.length = s;
9287  }
9288  return h;
9289}
9290function Fh(e, t, i, s, n, r, o, a, l, h, c) {
9291  c = c || [NaN, NaN];
9292  for (let u = 0, d = i.length; u < d; ++u) {
9293    const f = i[u];
9294    h = Oh(
9295      e,
9296      t,
9297      f,
9298      s,
9299      n,
9300      r,
9301      o,
9302      a,
9303      l,
9304      h,
9305      c
9306    ), t = f;
9307  }
9308  return h;
9309}
9310function BE(e, t, i, s, n, r, o, a, l, h, c) {
9311  c = c || [NaN, NaN];
9312  for (let u = 0, d = i.length; u < d; ++u) {
9313    const f = i[u];
9314    h = Fh(
9315      e,
9316      t,
9317      f,
9318      s,
9319      n,
9320      r,
9321      o,
9322      a,
9323      l,
9324      h,
9325      c
9326    ), t = f[f.length - 1];
9327  }
9328  return h;
9329}
9330function eg(e, t, i, s) {
9331  for (let n = 0, r = i.length; n < r; ++n)
9332    e[t++] = i[n];
9333  return t;
9334}
9335function ga(e, t, i, s) {
9336  for (let n = 0, r = i.length; n < r; ++n) {
9337    const o = i[n];
9338    for (let a = 0; a < s; ++a)
9339      e[t++] = o[a];
9340  }
9341  return t;
9342}
9343function kh(e, t, i, s, n) {
9344  n = n || [];
9345  let r = 0;
9346  for (let o = 0, a = i.length; o < a; ++o) {
9347    const l = ga(
9348      e,
9349      t,
9350      i[o],
9351      s
9352    );
9353    n[r++] = l, t = l;
9354  }
9355  return n.length = r, n;
9356}
9357function UE(e, t, i, s, n) {
9358  n = n || [];
9359  let r = 0;
9360  for (let o = 0, a = i.length; o < a; ++o) {
9361    const l = kh(
9362      e,
9363      t,
9364      i[o],
9365      s,
9366      n[r]
9367    );
9368    l.length === 0 && (l[0] = t), n[r++] = l, t = l[l.length - 1];
9369  }
9370  return n.length = r, n;
9371}
9372function Dh(e, t, i, s, n, r, o) {
9373  const a = (i - t) / s;
9374  if (a < 3) {
9375    for (; t < i; t += s)
9376      r[o++] = e[t], r[o++] = e[t + 1];
9377    return o;
9378  }
9379  const l = new Array(a);
9380  l[0] = 1, l[a - 1] = 1;
9381  const h = [t, i - s];
9382  let c = 0;
9383  for (; h.length > 0; ) {
9384    const u = h.pop(), d = h.pop();
9385    let f = 0;
9386    const g = e[d], _ = e[d + 1], m = e[u], p = e[u + 1];
9387    for (let y = d + s; y < u; y += s) {
9388      const v = e[y], E = e[y + 1], C = n1(v, E, g, _, m, p);
9389      C > f && (c = y, f = C);
9390    }
9391    f > n && (l[(c - t) / s] = 1, d + s < c && h.push(d, c), c + s < u && h.push(c, u));
9392  }
9393  for (let u = 0; u < a; ++u)
9394    l[u] && (r[o++] = e[t + u * s], r[o++] = e[t + u * s + 1]);
9395  return o;
9396}
9397function XE(e, t, i, s, n, r, o, a) {
9398  for (let l = 0, h = i.length; l < h; ++l) {
9399    const c = i[l];
9400    o = Dh(
9401      e,
9402      t,
9403      c,
9404      s,
9405      n,
9406      r,
9407      o
9408    ), a.push(o), t = c;
9409  }
9410  return o;
9411}
9412function ls(e, t) {
9413  return t * Math.round(e / t);
9414}
9415function $E(e, t, i, s, n, r, o) {
9416  if (t == i)
9417    return o;
9418  let a = ls(e[t], n), l = ls(e[t + 1], n);
9419  t += s, r[o++] = a, r[o++] = l;
9420  let h, c;
9421  do
9422    if (h = ls(e[t], n), c = ls(e[t + 1], n), t += s, t == i)
9423      return r[o++] = h, r[o++] = c, o;
9424  while (h == a && c == l);
9425  for (; t < i; ) {
9426    const u = ls(e[t], n), d = ls(e[t + 1], n);
9427    if (t += s, u == h && d == c)
9428      continue;
9429    const f = h - a, g = c - l, _ = u - a, m = d - l;
9430    if (f * m == g * _ && (f < 0 && _ < f || f == _ || f > 0 && _ > f) && (g < 0 && m < g || g == m || g > 0 && m > g)) {
9431      h = u, c = d;
9432      continue;
9433    }
9434    r[o++] = h, r[o++] = c, a = h, l = c, h = u, c = d;
9435  }
9436  return r[o++] = h, r[o++] = c, o;
9437}
9438function ig(e, t, i, s, n, r, o, a) {
9439  for (let l = 0, h = i.length; l < h; ++l) {
9440    const c = i[l];
9441    o = $E(
9442      e,
9443      t,
9444      c,
9445      s,
9446      n,
9447      r,
9448      o
9449    ), a.push(o), t = c;
9450  }
9451  return o;
9452}
9453function YE(e, t, i, s, n, r, o, a) {
9454  for (let l = 0, h = i.length; l < h; ++l) {
9455    const c = i[l], u = [];
9456    o = ig(
9457      e,
9458      t,
9459      c,
9460      s,
9461      n,
9462      r,
9463      o,
9464      u
9465    ), a.push(u), t = c[c.length - 1];
9466  }
9467  return o;
9468}
9469function ji(e, t, i, s, n) {
9470  n = n !== void 0 ? n : [];
9471  let r = 0;
9472  for (let o = t; o < i; o += s)
9473    n[r++] = e.slice(o, o + s);
9474  return n.length = r, n;
9475}
9476function cr(e, t, i, s, n) {
9477  n = n !== void 0 ? n : [];
9478  let r = 0;
9479  for (let o = 0, a = i.length; o < a; ++o) {
9480    const l = i[o];
9481    n[r++] = ji(
9482      e,
9483      t,
9484      l,
9485      s,
9486      n[r]
9487    ), t = l;
9488  }
9489  return n.length = r, n;
9490}
9491function Tl(e, t, i, s, n) {
9492  n = n !== void 0 ? n : [];
9493  let r = 0;
9494  for (let o = 0, a = i.length; o < a; ++o) {
9495    const l = i[o];
9496    n[r++] = l.length === 1 && l[0] === t ? [] : cr(
9497      e,
9498      t,
9499      l,
9500      s,
9501      n[r]
9502    ), t = l[l.length - 1];
9503  }
9504  return n.length = r, n;
9505}
9506function sg(e, t, i, s) {
9507  let n = 0, r = e[i - s], o = e[i - s + 1];
9508  for (; t < i; t += s) {
9509    const a = e[t], l = e[t + 1];
9510    n += o * a - r * l, r = a, o = l;
9511  }
9512  return n / 2;
9513}
9514function ng(e, t, i, s) {
9515  let n = 0;
9516  for (let r = 0, o = i.length; r < o; ++r) {
9517    const a = i[r];
9518    n += sg(e, t, a, s), t = a;
9519  }
9520  return n;
9521}
9522function KE(e, t, i, s) {
9523  let n = 0;
9524  for (let r = 0, o = i.length; r < o; ++r) {
9525    const a = i[r];
9526    n += ng(e, t, a, s), t = a[a.length - 1];
9527  }
9528  return n;
9529}
9530class ko extends es {
9531  /**
9532   * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
9533   *     For internal use, flat coordinates in combination with `layout` are also accepted.
9534   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
9535   */
9536  constructor(t, i) {
9537    super(), this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, i !== void 0 && !Array.isArray(t[0]) ? this.setFlatCoordinates(
9538      i,
9539      /** @type {Array<number>} */
9540      t
9541    ) : this.setCoordinates(
9542      /** @type {Array<import("../coordinate.js").Coordinate>} */
9543      t,
9544      i
9545    );
9546  }
9547  /**
9548   * Make a complete copy of the geometry.
9549   * @return {!LinearRing} Clone.
9550   * @api
9551   */
9552  clone() {
9553    return new ko(this.flatCoordinates.slice(), this.layout);
9554  }
9555  /**
9556   * @param {number} x X.
9557   * @param {number} y Y.
9558   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
9559   * @param {number} minSquaredDistance Minimum squared distance.
9560   * @return {number} Minimum squared distance.
9561   */
9562  closestPointXY(t, i, s, n) {
9563    return n < Ts(this.getExtent(), t, i) ? n : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
9564      Ah(
9565        this.flatCoordinates,
9566        0,
9567        this.flatCoordinates.length,
9568        this.stride,
9569        0
9570      )
9571    ), this.maxDeltaRevision_ = this.getRevision()), Oh(
9572      this.flatCoordinates,
9573      0,
9574      this.flatCoordinates.length,
9575      this.stride,
9576      this.maxDelta_,
9577      !0,
9578      t,
9579      i,
9580      s,
9581      n
9582    ));
9583  }
9584  /**
9585   * Return the area of the linear ring on projected plane.
9586   * @return {number} Area (on projected plane).
9587   * @api
9588   */
9589  getArea() {
9590    return sg(
9591      this.flatCoordinates,
9592      0,
9593      this.flatCoordinates.length,
9594      this.stride
9595    );
9596  }
9597  /**
9598   * Return the coordinates of the linear ring.
9599   * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
9600   * @api
9601   */
9602  getCoordinates() {
9603    return ji(
9604      this.flatCoordinates,
9605      0,
9606      this.flatCoordinates.length,
9607      this.stride
9608    );
9609  }
9610  /**
9611   * @param {number} squaredTolerance Squared tolerance.
9612   * @return {LinearRing} Simplified LinearRing.
9613   * @protected
9614   */
9615  getSimplifiedGeometryInternal(t) {
9616    const i = [];
9617    return i.length = Dh(
9618      this.flatCoordinates,
9619      0,
9620      this.flatCoordinates.length,
9621      this.stride,
9622      t,
9623      i,
9624      0
9625    ), new ko(i, "XY");
9626  }
9627  /**
9628   * Get the type of this geometry.
9629   * @return {import("./Geometry.js").Type} Geometry type.
9630   * @api
9631   */
9632  getType() {
9633    return "LinearRing";
9634  }
9635  /**
9636   * Test if the geometry and the passed extent intersect.
9637   * @param {import("../extent.js").Extent} extent Extent.
9638   * @return {boolean} `true` if the geometry and the extent intersect.
9639   * @api
9640   */
9641  intersectsExtent(t) {
9642    return !1;
9643  }
9644  /**
9645   * Set the coordinates of the linear ring.
9646   * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
9647   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
9648   * @api
9649   */
9650  setCoordinates(t, i) {
9651    this.setLayout(i, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = ga(
9652      this.flatCoordinates,
9653      0,
9654      t,
9655      this.stride
9656    ), this.changed();
9657  }
9658}
9659const Tu = ko;
9660class Nh extends es {
9661  /**
9662   * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
9663   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
9664   */
9665  constructor(t, i) {
9666    super(), this.setCoordinates(t, i);
9667  }
9668  /**
9669   * Make a complete copy of the geometry.
9670   * @return {!Point} Clone.
9671   * @api
9672   */
9673  clone() {
9674    const t = new Nh(this.flatCoordinates.slice(), this.layout);
9675    return t.applyProperties(this), t;
9676  }
9677  /**
9678   * @param {number} x X.
9679   * @param {number} y Y.
9680   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
9681   * @param {number} minSquaredDistance Minimum squared distance.
9682   * @return {number} Minimum squared distance.
9683   */
9684  closestPointXY(t, i, s, n) {
9685    const r = this.flatCoordinates, o = gi(
9686      t,
9687      i,
9688      r[0],
9689      r[1]
9690    );
9691    if (o < n) {
9692      const a = this.stride;
9693      for (let l = 0; l < a; ++l)
9694        s[l] = r[l];
9695      return s.length = a, o;
9696    }
9697    return n;
9698  }
9699  /**
9700   * Return the coordinate of the point.
9701   * @return {import("../coordinate.js").Coordinate} Coordinates.
9702   * @api
9703   */
9704  getCoordinates() {
9705    return this.flatCoordinates ? this.flatCoordinates.slice() : [];
9706  }
9707  /**
9708   * @param {import("../extent.js").Extent} extent Extent.
9709   * @protected
9710   * @return {import("../extent.js").Extent} extent Extent.
9711   */
9712  computeExtent(t) {
9713    return go(this.flatCoordinates, t);
9714  }
9715  /**
9716   * Get the type of this geometry.
9717   * @return {import("./Geometry.js").Type} Geometry type.
9718   * @api
9719   */
9720  getType() {
9721    return "Point";
9722  }
9723  /**
9724   * Test if the geometry and the passed extent intersect.
9725   * @param {import("../extent.js").Extent} extent Extent.
9726   * @return {boolean} `true` if the geometry and the extent intersect.
9727   * @api
9728   */
9729  intersectsExtent(t) {
9730    return Vl(t, this.flatCoordinates[0], this.flatCoordinates[1]);
9731  }
9732  /**
9733   * @param {!Array<*>} coordinates Coordinates.
9734   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
9735   * @api
9736   */
9737  setCoordinates(t, i) {
9738    this.setLayout(i, t, 0), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = eg(
9739      this.flatCoordinates,
9740      0,
9741      t,
9742      this.stride
9743    ), this.changed();
9744  }
9745}
9746const yi = Nh;
9747function qE(e, t, i, s, n) {
9748  return !Hl(
9749    n,
9750    /**
9751     * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
9752     * @return {boolean} Contains (x, y).
9753     */
9754    function(o) {
9755      return !us(
9756        e,
9757        t,
9758        i,
9759        s,
9760        o[0],
9761        o[1]
9762      );
9763    }
9764  );
9765}
9766function us(e, t, i, s, n, r) {
9767  let o = 0, a = e[i - s], l = e[i - s + 1];
9768  for (; t < i; t += s) {
9769    const h = e[t], c = e[t + 1];
9770    l <= r ? c > r && (h - a) * (r - l) - (n - a) * (c - l) > 0 && o++ : c <= r && (h - a) * (r - l) - (n - a) * (c - l) < 0 && o--, a = h, l = c;
9771  }
9772  return o !== 0;
9773}
9774function Gh(e, t, i, s, n, r) {
9775  if (i.length === 0 || !us(e, t, i[0], s, n, r))
9776    return !1;
9777  for (let o = 1, a = i.length; o < a; ++o)
9778    if (us(e, i[o - 1], i[o], s, n, r))
9779      return !1;
9780  return !0;
9781}
9782function VE(e, t, i, s, n, r) {
9783  if (i.length === 0)
9784    return !1;
9785  for (let o = 0, a = i.length; o < a; ++o) {
9786    const l = i[o];
9787    if (Gh(e, t, l, s, n, r))
9788      return !0;
9789    t = l[l.length - 1];
9790  }
9791  return !1;
9792}
9793function rg(e, t, i, s, n, r, o) {
9794  let a, l, h, c, u, d, f;
9795  const g = n[r + 1], _ = [];
9796  for (let y = 0, v = i.length; y < v; ++y) {
9797    const E = i[y];
9798    for (c = e[E - s], d = e[E - s + 1], a = t; a < E; a += s)
9799      u = e[a], f = e[a + 1], (g <= d && f <= g || d <= g && g <= f) && (h = (g - d) / (f - d) * (u - c) + c, _.push(h)), c = u, d = f;
9800  }
9801  let m = NaN, p = -1 / 0;
9802  for (_.sort(ws), c = _[0], a = 1, l = _.length; a < l; ++a) {
9803    u = _[a];
9804    const y = Math.abs(u - c);
9805    y > p && (h = (c + u) / 2, Gh(e, t, i, s, h, g) && (m = h, p = y)), c = u;
9806  }
9807  return isNaN(m) && (m = n[r]), o ? (o.push(m, g, p), o) : [m, g, p];
9808}
9809function HE(e, t, i, s, n) {
9810  let r = [];
9811  for (let o = 0, a = i.length; o < a; ++o) {
9812    const l = i[o];
9813    r = rg(
9814      e,
9815      t,
9816      l,
9817      s,
9818      n,
9819      2 * o,
9820      r
9821    ), t = l[l.length - 1];
9822  }
9823  return r;
9824}
9825function og(e, t, i, s, n) {
9826  let r;
9827  for (t += s; t < i; t += s)
9828    if (r = n(
9829      e.slice(t - s, t),
9830      e.slice(t, t + s)
9831    ), r)
9832      return r;
9833  return !1;
9834}
9835function _a(e, t, i, s, n) {
9836  const r = Wd(
9837    ve(),
9838    e,
9839    t,
9840    i,
9841    s
9842  );
9843  return ee(n, r) ? Gi(n, r) || r[0] >= n[0] && r[2] <= n[2] || r[1] >= n[1] && r[3] <= n[3] ? !0 : og(
9844    e,
9845    t,
9846    i,
9847    s,
9848    /**
9849     * @param {import("../../coordinate.js").Coordinate} point1 Start point.
9850     * @param {import("../../coordinate.js").Coordinate} point2 End point.
9851     * @return {boolean} `true` if the segment and the extent intersect,
9852     *     `false` otherwise.
9853     */
9854    function(o, a) {
9855      return e1(n, o, a);
9856    }
9857  ) : !1;
9858}
9859function ZE(e, t, i, s, n) {
9860  for (let r = 0, o = i.length; r < o; ++r) {
9861    if (_a(e, t, i[r], s, n))
9862      return !0;
9863    t = i[r];
9864  }
9865  return !1;
9866}
9867function ag(e, t, i, s, n) {
9868  return !!(_a(e, t, i, s, n) || us(
9869    e,
9870    t,
9871    i,
9872    s,
9873    n[0],
9874    n[1]
9875  ) || us(
9876    e,
9877    t,
9878    i,
9879    s,
9880    n[0],
9881    n[3]
9882  ) || us(
9883    e,
9884    t,
9885    i,
9886    s,
9887    n[2],
9888    n[1]
9889  ) || us(
9890    e,
9891    t,
9892    i,
9893    s,
9894    n[2],
9895    n[3]
9896  ));
9897}
9898function lg(e, t, i, s, n) {
9899  if (!ag(e, t, i[0], s, n))
9900    return !1;
9901  if (i.length === 1)
9902    return !0;
9903  for (let r = 1, o = i.length; r < o; ++r)
9904    if (qE(
9905      e,
9906      i[r - 1],
9907      i[r],
9908      s,
9909      n
9910    ) && !_a(
9911      e,
9912      i[r - 1],
9913      i[r],
9914      s,
9915      n
9916    ))
9917      return !1;
9918  return !0;
9919}
9920function JE(e, t, i, s, n) {
9921  for (let r = 0, o = i.length; r < o; ++r) {
9922    const a = i[r];
9923    if (lg(e, t, a, s, n))
9924      return !0;
9925    t = a[a.length - 1];
9926  }
9927  return !1;
9928}
9929function QE(e, t, i, s) {
9930  for (; t < i - s; ) {
9931    for (let n = 0; n < s; ++n) {
9932      const r = e[t + n];
9933      e[t + n] = e[i - s + n], e[i - s + n] = r;
9934    }
9935    t += s, i -= s;
9936  }
9937}
9938function hg(e, t, i, s) {
9939  let n = 0, r = e[i - s], o = e[i - s + 1];
9940  for (; t < i; t += s) {
9941    const a = e[t], l = e[t + 1];
9942    n += (a - r) * (l + o), r = a, o = l;
9943  }
9944  return n === 0 ? void 0 : n > 0;
9945}
9946function cg(e, t, i, s, n) {
9947  n = n !== void 0 ? n : !1;
9948  for (let r = 0, o = i.length; r < o; ++r) {
9949    const a = i[r], l = hg(
9950      e,
9951      t,
9952      a,
9953      s
9954    );
9955    if (r === 0) {
9956      if (n && l || !n && !l)
9957        return !1;
9958    } else if (n && !l || !n && l)
9959      return !1;
9960    t = a;
9961  }
9962  return !0;
9963}
9964function tM(e, t, i, s, n) {
9965  for (let r = 0, o = i.length; r < o; ++r) {
9966    const a = i[r];
9967    if (!cg(e, t, a, s, n))
9968      return !1;
9969    a.length && (t = a[a.length - 1]);
9970  }
9971  return !0;
9972}
9973function Rl(e, t, i, s, n) {
9974  n = n !== void 0 ? n : !1;
9975  for (let r = 0, o = i.length; r < o; ++r) {
9976    const a = i[r], l = hg(
9977      e,
9978      t,
9979      a,
9980      s
9981    );
9982    (r === 0 ? n && l || !n && !l : n && !l || !n && l) && QE(e, t, a, s), t = a;
9983  }
9984  return t;
9985}
9986function Ru(e, t, i, s, n) {
9987  for (let r = 0, o = i.length; r < o; ++r)
9988    t = Rl(
9989      e,
9990      t,
9991      i[r],
9992      s,
9993      n
9994    );
9995  return t;
9996}
9997class Cn extends es {
9998  /**
9999   * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
10000   *     Array of linear rings that define the polygon. The first linear ring of the
10001   *     array defines the outer-boundary or surface of the polygon. Each subsequent
10002   *     linear ring defines a hole in the surface of the polygon. A linear ring is
10003   *     an array of vertices' coordinates where the first coordinate and the last are
10004   *     equivalent. (For internal use, flat coordinates in combination with
10005   *     `layout` and `ends` are also accepted.)
10006   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
10007   * @param {Array<number>} [ends] Ends (for internal use with flat coordinates).
10008   */
10009  constructor(t, i, s) {
10010    super(), this.ends_ = [], this.flatInteriorPointRevision_ = -1, this.flatInteriorPoint_ = null, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, this.orientedRevision_ = -1, this.orientedFlatCoordinates_ = null, i !== void 0 && s ? (this.setFlatCoordinates(
10011      i,
10012      /** @type {Array<number>} */
10013      t
10014    ), this.ends_ = s) : this.setCoordinates(
10015      /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */
10016      t,
10017      i
10018    );
10019  }
10020  /**
10021   * Append the passed linear ring to this polygon.
10022   * @param {LinearRing} linearRing Linear ring.
10023   * @api
10024   */
10025  appendLinearRing(t) {
10026    this.flatCoordinates ? pi(this.flatCoordinates, t.getFlatCoordinates()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.ends_.push(this.flatCoordinates.length), this.changed();
10027  }
10028  /**
10029   * Make a complete copy of the geometry.
10030   * @return {!Polygon} Clone.
10031   * @api
10032   */
10033  clone() {
10034    const t = new Cn(
10035      this.flatCoordinates.slice(),
10036      this.layout,
10037      this.ends_.slice()
10038    );
10039    return t.applyProperties(this), t;
10040  }
10041  /**
10042   * @param {number} x X.
10043   * @param {number} y Y.
10044   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
10045   * @param {number} minSquaredDistance Minimum squared distance.
10046   * @return {number} Minimum squared distance.
10047   */
10048  closestPointXY(t, i, s, n) {
10049    return n < Ts(this.getExtent(), t, i) ? n : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
10050      Lh(
10051        this.flatCoordinates,
10052        0,
10053        this.ends_,
10054        this.stride,
10055        0
10056      )
10057    ), this.maxDeltaRevision_ = this.getRevision()), Fh(
10058      this.flatCoordinates,
10059      0,
10060      this.ends_,
10061      this.stride,
10062      this.maxDelta_,
10063      !0,
10064      t,
10065      i,
10066      s,
10067      n
10068    ));
10069  }
10070  /**
10071   * @param {number} x X.
10072   * @param {number} y Y.
10073   * @return {boolean} Contains (x, y).
10074   */
10075  containsXY(t, i) {
10076    return Gh(
10077      this.getOrientedFlatCoordinates(),
10078      0,
10079      this.ends_,
10080      this.stride,
10081      t,
10082      i
10083    );
10084  }
10085  /**
10086   * Return the area of the polygon on projected plane.
10087   * @return {number} Area (on projected plane).
10088   * @api
10089   */
10090  getArea() {
10091    return ng(
10092      this.getOrientedFlatCoordinates(),
10093      0,
10094      this.ends_,
10095      this.stride
10096    );
10097  }
10098  /**
10099   * Get the coordinate array for this geometry.  This array has the structure
10100   * of a GeoJSON coordinate array for polygons.
10101   *
10102   * @param {boolean} [right] Orient coordinates according to the right-hand
10103   *     rule (counter-clockwise for exterior and clockwise for interior rings).
10104   *     If `false`, coordinates will be oriented according to the left-hand rule
10105   *     (clockwise for exterior and counter-clockwise for interior rings).
10106   *     By default, coordinate orientation will depend on how the geometry was
10107   *     constructed.
10108   * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
10109   * @api
10110   */
10111  getCoordinates(t) {
10112    let i;
10113    return t !== void 0 ? (i = this.getOrientedFlatCoordinates().slice(), Rl(i, 0, this.ends_, this.stride, t)) : i = this.flatCoordinates, cr(i, 0, this.ends_, this.stride);
10114  }
10115  /**
10116   * @return {Array<number>} Ends.
10117   */
10118  getEnds() {
10119    return this.ends_;
10120  }
10121  /**
10122   * @return {Array<number>} Interior point.
10123   */
10124  getFlatInteriorPoint() {
10125    if (this.flatInteriorPointRevision_ != this.getRevision()) {
10126      const t = ii(this.getExtent());
10127      this.flatInteriorPoint_ = rg(
10128        this.getOrientedFlatCoordinates(),
10129        0,
10130        this.ends_,
10131        this.stride,
10132        t,
10133        0
10134      ), this.flatInteriorPointRevision_ = this.getRevision();
10135    }
10136    return this.flatInteriorPoint_;
10137  }
10138  /**
10139   * Return an interior point of the polygon.
10140   * @return {Point} Interior point as XYM coordinate, where M is the
10141   * length of the horizontal intersection that the point belongs to.
10142   * @api
10143   */
10144  getInteriorPoint() {
10145    return new yi(this.getFlatInteriorPoint(), "XYM");
10146  }
10147  /**
10148   * Return the number of rings of the polygon,  this includes the exterior
10149   * ring and any interior rings.
10150   *
10151   * @return {number} Number of rings.
10152   * @api
10153   */
10154  getLinearRingCount() {
10155    return this.ends_.length;
10156  }
10157  /**
10158   * Return the Nth linear ring of the polygon geometry. Return `null` if the
10159   * given index is out of range.
10160   * The exterior linear ring is available at index `0` and the interior rings
10161   * at index `1` and beyond.
10162   *
10163   * @param {number} index Index.
10164   * @return {LinearRing|null} Linear ring.
10165   * @api
10166   */
10167  getLinearRing(t) {
10168    return t < 0 || this.ends_.length <= t ? null : new Tu(
10169      this.flatCoordinates.slice(
10170        t === 0 ? 0 : this.ends_[t - 1],
10171        this.ends_[t]
10172      ),
10173      this.layout
10174    );
10175  }
10176  /**
10177   * Return the linear rings of the polygon.
10178   * @return {Array<LinearRing>} Linear rings.
10179   * @api
10180   */
10181  getLinearRings() {
10182    const t = this.layout, i = this.flatCoordinates, s = this.ends_, n = [];
10183    let r = 0;
10184    for (let o = 0, a = s.length; o < a; ++o) {
10185      const l = s[o], h = new Tu(
10186        i.slice(r, l),
10187        t
10188      );
10189      n.push(h), r = l;
10190    }
10191    return n;
10192  }
10193  /**
10194   * @return {Array<number>} Oriented flat coordinates.
10195   */
10196  getOrientedFlatCoordinates() {
10197    if (this.orientedRevision_ != this.getRevision()) {
10198      const t = this.flatCoordinates;
10199      cg(t, 0, this.ends_, this.stride) ? this.orientedFlatCoordinates_ = t : (this.orientedFlatCoordinates_ = t.slice(), this.orientedFlatCoordinates_.length = Rl(
10200        this.orientedFlatCoordinates_,
10201        0,
10202        this.ends_,
10203        this.stride
10204      )), this.orientedRevision_ = this.getRevision();
10205    }
10206    return this.orientedFlatCoordinates_;
10207  }
10208  /**
10209   * @param {number} squaredTolerance Squared tolerance.
10210   * @return {Polygon} Simplified Polygon.
10211   * @protected
10212   */
10213  getSimplifiedGeometryInternal(t) {
10214    const i = [], s = [];
10215    return i.length = ig(
10216      this.flatCoordinates,
10217      0,
10218      this.ends_,
10219      this.stride,
10220      Math.sqrt(t),
10221      i,
10222      0,
10223      s
10224    ), new Cn(i, "XY", s);
10225  }
10226  /**
10227   * Get the type of this geometry.
10228   * @return {import("./Geometry.js").Type} Geometry type.
10229   * @api
10230   */
10231  getType() {
10232    return "Polygon";
10233  }
10234  /**
10235   * Test if the geometry and the passed extent intersect.
10236   * @param {import("../extent.js").Extent} extent Extent.
10237   * @return {boolean} `true` if the geometry and the extent intersect.
10238   * @api
10239   */
10240  intersectsExtent(t) {
10241    return lg(
10242      this.getOrientedFlatCoordinates(),
10243      0,
10244      this.ends_,
10245      this.stride,
10246      t
10247    );
10248  }
10249  /**
10250   * Set the coordinates of the polygon.
10251   * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
10252   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
10253   * @api
10254   */
10255  setCoordinates(t, i) {
10256    this.setLayout(i, t, 2), this.flatCoordinates || (this.flatCoordinates = []);
10257    const s = kh(
10258      this.flatCoordinates,
10259      0,
10260      t,
10261      this.stride,
10262      this.ends_
10263    );
10264    this.flatCoordinates.length = s.length === 0 ? 0 : s[s.length - 1], this.changed();
10265  }
10266}
10267const bn = Cn;
10268function Iu(e) {
10269  const t = e[0], i = e[1], s = e[2], n = e[3], r = [
10270    t,
10271    i,
10272    t,
10273    n,
10274    s,
10275    n,
10276    s,
10277    i,
10278    t,
10279    i
10280  ];
10281  return new Cn(r, "XY", [r.length]);
10282}
10283function eM(e, t, i) {
10284  t = t || 32;
10285  const s = e.getStride(), n = e.getLayout(), r = e.getCenter(), o = s * (t + 1), a = new Array(o);
10286  for (let c = 0; c < o; c += s) {
10287    a[c] = 0, a[c + 1] = 0;
10288    for (let u = 2; u < s; u++)
10289      a[c + u] = r[u];
10290  }
10291  const l = [a.length], h = new Cn(a, n, l);
10292  return iM(h, r, e.getRadius(), i), h;
10293}
10294function iM(e, t, i, s) {
10295  const n = e.getFlatCoordinates(), r = e.getStride(), o = n.length / r - 1, a = s || 0;
10296  for (let l = 0; l <= o; ++l) {
10297    const h = l * r, c = a + $i(l, o) * 2 * Math.PI / o;
10298    n[h] = t[0] + i * Math.cos(c), n[h + 1] = t[1] + i * Math.sin(c);
10299  }
10300  e.changed();
10301}
10302const Da = 0;
10303class sM extends ni {
10304  /**
10305   * @param {ViewOptions} [options] View options.
10306   */
10307  constructor(t) {
10308    super(), this.on, this.once, this.un, t = Object.assign({}, t), this.hints_ = [0, 0], this.animations_ = [], this.updateAnimationKey_, this.projection_ = th(t.projection, "EPSG:3857"), this.viewportSize_ = [100, 100], this.targetCenter_ = null, this.targetResolution_, this.targetRotation_, this.nextCenter_ = null, this.nextResolution_, this.nextRotation_, this.cancelAnchor_ = void 0, t.projection && d1(), t.center && (t.center = Pt(t.center, this.projection_)), t.extent && (t.extent = He(t.extent, this.projection_)), this.applyOptions_(t);
10309  }
10310  /**
10311   * Set up the view with the given options.
10312   * @param {ViewOptions} options View options.
10313   */
10314  applyOptions_(t) {
10315    const i = Object.assign({}, t);
10316    for (const a in Le)
10317      delete i[a];
10318    this.setProperties(i, !0);
10319    const s = rM(t);
10320    this.maxResolution_ = s.maxResolution, this.minResolution_ = s.minResolution, this.zoomFactor_ = s.zoomFactor, this.resolutions_ = t.resolutions, this.padding_ = t.padding, this.minZoom_ = s.minZoom;
10321    const n = nM(t), r = s.constraint, o = oM(t);
10322    this.constraints_ = {
10323      center: n,
10324      resolution: r,
10325      rotation: o
10326    }, this.setRotation(t.rotation !== void 0 ? t.rotation : 0), this.setCenterInternal(
10327      t.center !== void 0 ? t.center : null
10328    ), t.resolution !== void 0 ? this.setResolution(t.resolution) : t.zoom !== void 0 && this.setZoom(t.zoom);
10329  }
10330  /**
10331   * Padding (in css pixels).
10332   * If the map viewport is partially covered with other content (overlays) along
10333   * its edges, this setting allows to shift the center of the viewport away from that
10334   * content. The order of the values in the array is top, right, bottom, left.
10335   * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.
10336   * @type {Array<number>|undefined}
10337   * @api
10338   */
10339  get padding() {
10340    return this.padding_;
10341  }
10342  set padding(t) {
10343    let i = this.padding_;
10344    this.padding_ = t;
10345    const s = this.getCenterInternal();
10346    if (s) {
10347      const n = t || [0, 0, 0, 0];
10348      i = i || [0, 0, 0, 0];
10349      const r = this.getResolution(), o = r / 2 * (n[3] - i[3] + i[
103491] - n[1]), a = r / 2 * (n[0] - i[0] + i[2] - n[2]);
10350      this.setCenterInternal([s[0] + o, s[1] - a]);
10351    }
10352  }
10353  /**
10354   * Get an updated version of the view options used to construct the view.  The
10355   * current resolution (or zoom), center, and rotation are applied to any stored
10356   * options.  The provided options can be used to apply new min/max zoom or
10357   * resolution limits.
10358   * @param {ViewOptions} newOptions New options to be applied.
10359   * @return {ViewOptions} New options updated with the current view state.
10360   */
10361  getUpdatedOptions_(t) {
10362    const i = this.getProperties();
10363    return i.resolution !== void 0 ? i.resolution = this.getResolution() : i.zoom = this.getZoom(), i.center = this.getCenterInternal(), i.rotation = this.getRotation(), Object.assign({}, i, t);
10364  }
10365  /**
10366   * Animate the view.  The view's center, zoom (or resolution), and rotation
10367   * can be animated for smooth transitions between view states.  For example,
10368   * to animate the view to a new zoom level:
10369   *
10370   *     view.animate({zoom: view.getZoom() + 1});
10371   *
10372   * By default, the animation lasts one second and uses in-and-out easing.  You
10373   * can customize this behavior by including `duration` (in milliseconds) and
10374   * `easing` options (see {@link module:ol/easing}).
10375   *
10376   * To chain together multiple animations, call the method with multiple
10377   * animation objects.  For example, to first zoom and then pan:
10378   *
10379   *     view.animate({zoom: 10}, {center: [0, 0]});
10380   *
10381   * If you provide a function as the last argument to the animate method, it
10382   * will get called at the end of an animation series.  The callback will be
10383   * called with `true` if the animation series completed on its own or `false`
10384   * if it was cancelled.
10385   *
10386   * Animations are cancelled by user interactions (e.g. dragging the map) or by
10387   * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
10388   * (or another method that calls one of these).
10389   *
10390   * @param {...(AnimationOptions|function(boolean): void)} var_args Animation
10391   *     options.  Multiple animations can be run in series by passing multiple
10392   *     options objects.  To run multiple animations in parallel, call the method
10393   *     multiple times.  An optional callback can be provided as a final
10394   *     argument.  The callback will be called with a boolean indicating whether
10395   *     the animation completed without being cancelled.
10396   * @api
10397   */
10398  animate(t) {
10399    this.isDef() && !this.getAnimating() && this.resolveConstraints(0);
10400    const i = new Array(arguments.length);
10401    for (let s = 0; s < i.length; ++s) {
10402      let n = arguments[s];
10403      n.center && (n = Object.assign({}, n), n.center = Pt(
10404        n.center,
10405        this.getProjection()
10406      )), n.anchor && (n = Object.assign({}, n), n.anchor = Pt(
10407        n.anchor,
10408        this.getProjection()
10409      )), i[s] = n;
10410    }
10411    this.animateInternal.apply(this, i);
10412  }
10413  /**
10414   * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.
10415   */
10416  animateInternal(t) {
10417    let i = arguments.length, s;
10418    i > 1 && typeof arguments[i - 1] == "function" && (s = arguments[i - 1], --i);
10419    let n = 0;
10420    for (; n < i && !this.isDef(); ++n) {
10421      const c = arguments[n];
10422      c.center && this.setCenterInternal(c.center), c.zoom !== void 0 ? this.setZoom(c.zoom) : c.resolution && this.setResolution(c.resolution), c.rotation !== void 0 && this.setRotation(c.rotation);
10423    }
10424    if (n === i) {
10425      s && Hr(s, !0);
10426      return;
10427    }
10428    let r = Date.now(), o = this.targetCenter_.slice(), a = this.targetResolution_, l = this.targetRotation_;
10429    const h = [];
10430    for (; n < i; ++n) {
10431      const c = (
10432        /** @type {AnimationOptions} */
10433        arguments[n]
10434      ), u = {
10435        start: r,
10436        complete: !1,
10437        anchor: c.anchor,
10438        duration: c.duration !== void 0 ? c.duration : 1e3,
10439        easing: c.easing || FE,
10440        callback: s
10441      };
10442      if (c.center && (u.sourceCenter = o, u.targetCenter = c.center.slice(), o = u.targetCenter), c.zoom !== void 0 ? (u.sourceResolution = a, u.targetResolution = this.getResolutionForZoom(c.zoom), a = u.targetResolution) : c.resolution && (u.sourceResolution = a, u.targetResolution = c.resolution, a = u.targetResolution), c.rotation !== void 0) {
10443        u.sourceRotation = l;
10444        const d = $i(c.rotation - l + Math.PI, 2 * Math.PI) - Math.PI;
10445        u.targetRotation = l + d, l = u.targetRotation;
10446      }
10447      aM(u) ? u.complete = !0 : r += u.duration, h.push(u);
10448    }
10449    this.animations_.push(h), this.setHint(Xt.ANIMATING, 1), this.updateAnimations_();
10450  }
10451  /**
10452   * Determine if the view is being animated.
10453   * @return {boolean} The view is being animated.
10454   * @api
10455   */
10456  getAnimating() {
10457    return this.hints_[Xt.ANIMATING] > 0;
10458  }
10459  /**
10460   * Determine if the user is interacting with the view, such as panning or zooming.
10461   * @return {boolean} The view is being interacted with.
10462   * @api
10463   */
10464  getInteracting() {
10465    return this.hints_[Xt.INTERACTING] > 0;
10466  }
10467  /**
10468   * Cancel any ongoing animations.
10469   * @api
10470   */
10471  cancelAnimations() {
10472    this.setHint(Xt.ANIMATING, -this.hints_[Xt.ANIMATING]);
10473    let t;
10474    for (let i = 0, s = this.animations_.length; i < s; ++i) {
10475      const n = this.animations_[i];
10476      if (n[0].callback && Hr(n[0].callback, !1), !t)
10477        for (let r = 0, o = n.length; r < o; ++r) {
10478          const a = n[r];
10479          if (!a.complete) {
10480            t = a.anchor;
10481            break;
10482          }
10483        }
10484    }
10485    this.animations_.length = 0, this.cancelAnchor_ = t, this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
10486  }
10487  /**
10488   * Update all animations.
10489   */
10490  updateAnimations_() {
10491    if (this.updateAnimationKey_ !== void 0 && (cancelAnimationFrame(this.updateAnimationKey_), this.updateAnimationKey_ = void 0), !this.getAnimating())
10492      return;
10493    const t = Date.now();
10494    let i = !1;
10495    for (let s = this.animations_.length - 1; s >= 0; --s) {
10496      const n = this.animations_[s];
10497      let r = !0;
10498      for (let o = 0, a = n.length; o < a; ++o) {
10499        const l = n[o];
10500        if (l.complete)
10501          continue;
10502        const h = t - l.start;
10503        let c = l.duration > 0 ? h / l.duration : 1;
10504        c >= 1 ? (l.complete = !0, c = 1) : r = !1;
10505        const u = l.easing(c);
10506        if (l.sourceCenter) {
10507          const d = l.sourceCenter[0], f = l.sourceCenter[1], g = l.targetCenter[0], _ = l.targetCenter[1];
10508          this.nextCenter_ = l.targetCenter;
10509          const m = d + u * (g - d), p = f + u * (_ - f);
10510          this.targetCenter_ = [m, p];
10511        }
10512        if (l.sourceResolution && l.targetResolution) {
10513          const d = u === 1 ? l.targetResolution : l.sourceResolution + u * (l.targetResolution - l.sourceResolution);
10514          if (l.anchor) {
10515            const f = this.getViewportSize_(this.getRotation()), g = this.constraints_.resolution(
10516              d,
10517              0,
10518              f,
10519              !0
10520            );
10521            this.targetCenter_ = this.calculateCenterZoom(
10522              g,
10523              l.anchor
10524            );
10525          }
10526          this.nextResolution_ = l.targetResolution, this.targetResolution_ = d, this.applyTargetState_(!0);
10527        }
10528        if (l.sourceRotation !== void 0 && l.targetRotation !== void 0) {
10529          const d = u === 1 ? $i(l.targetRotation + Math.PI, 2 * Math.PI) - Math.PI : l.sourceRotation + u * (l.targetRotation - l.sourceRotation);
10530          if (l.anchor) {
10531            const f = this.constraints_.rotation(
10532              d,
10533              !0
10534            );
10535            this.targetCenter_ = this.calculateCenterRotate(
10536              f,
10537              l.anchor
10538            );
10539          }
10540          this.nextRotation_ = l.targetRotation, this.targetRotation_ = d;
10541        }
10542        if (this.applyTargetState_(!0), i = !0, !l.complete)
10543          break;
10544      }
10545      if (r) {
10546        this.animations_[s] = null, this.setHint(Xt.ANIMATING, -1), this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
10547        const o = n[0].callback;
10548        o && Hr(o, !0);
10549      }
10550    }
10551    this.animations_ = this.animations_.filter(Boolean), i && this.updateAnimationKey_ === void 0 && (this.updateAnimationKey_ = requestAnimationFrame(
10552      this.updateAnimations_.bind(this)
10553    ));
10554  }
10555  /**
10556   * @param {number} rotation Target rotation.
10557   * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
10558   * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
10559   */
10560  calculateCenterRotate(t, i) {
10561    let s;
10562    const n = this.getCenterInternal();
10563    return n !== void 0 && (s = [n[0] - i[0], n[1] - i[1]], Jl(s, t - this.getRotation()), o1(s, i)
10563), s;
10564  }
10565  /**
10566   * @param {number} resolution Target resolution.
10567   * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
10568   * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
10569   */
10570  calculateCenterZoom(t, i) {
10571    let s;
10572    const n = this.getCenterInternal(), r = this.getResolution();
10573    if (n !== void 0 && r !== void 0) {
10574      const o = i[0] - t * (i[0] - n[0]) / r, a = i[1] - t * (i[1] - n[1]) / r;
10575      s = [o, a];
10576    }
10577    return s;
10578  }
10579  /**
10580   * Returns the current viewport size.
10581   * @private
10582   * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
10583   * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
10584   */
10585  getViewportSize_(t) {
10586    const i = this.viewportSize_;
10587    if (t) {
10588      const s = i[0], n = i[1];
10589      return [
10590        Math.abs(s * Math.cos(t)) + Math.abs(n * Math.sin(t)),
10591        Math.abs(s * Math.sin(t)) + Math.abs(n * Math.cos(t))
10592      ];
10593    }
10594    return i;
10595  }
10596  /**
10597   * Stores the viewport size on the view. The viewport size is not read every time from the DOM
10598   * to avoid performance hit and layout reflow.
10599   * This should be done on map size change.
10600   * Note: the constraints are not resolved during an animation to avoid stopping it
10601   * @param {import("./size.js").Size} [size] Viewport size; if undefined, [100, 100] is assumed
10602   */
10603  setViewportSize(t) {
10604    this.viewportSize_ = Array.isArray(t) ? t.slice() : [100, 100], this.getAnimating() || this.resolveConstraints(0);
10605  }
10606  /**
10607   * Get the view center.
10608   * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
10609   * @observable
10610   * @api
10611   */
10612  getCenter() {
10613    const t = this.getCenterInternal();
10614    return t && Cs(t, this.getProjection());
10615  }
10616  /**
10617   * Get the view center without transforming to user projection.
10618   * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
10619   */
10620  getCenterInternal() {
10621    return (
10622      /** @type {import("./coordinate.js").Coordinate|undefined} */
10623      this.get(Le.CENTER)
10624    );
10625  }
10626  /**
10627   * @return {Constraints} Constraints.
10628   */
10629  getConstraints() {
10630    return this.constraints_;
10631  }
10632  /**
10633   * @return {boolean} Resolution constraint is set
10634   */
10635  getConstrainResolution() {
10636    return this.get("constrainResolution");
10637  }
10638  /**
10639   * @param {Array<number>} [hints] Destination array.
10640   * @return {Array<number>} Hint.
10641   */
10642  getHints(t) {
10643    return t !== void 0 ? (t[0] = this.hints_[0], t[1] = this.hints_[1], t) : this.hints_.slice();
10644  }
10645  /**
10646   * Calculate the extent for the current view state and the passed size.
10647   * The size is the pixel dimensions of the box into which the calculated extent
10648   * should fit. In most cases you want to get the extent of the entire map,
10649   * that is `map.getSize()`.
10650   * @param {import("./size.js").Size} [size] Box pixel size. If not provided, the size
10651   * of the map that uses this view will be used.
10652   * @return {import("./extent.js").Extent} Extent.
10653   * @api
10654   */
10655  calculateExtent(t) {
10656    const i = this.calculateExtentInternal(t);
10657    return Qo(i, this.getProjection());
10658  }
10659  /**
10660   * @param {import("./size.js").Size} [size] Box pixel size. If not provided,
10661   * the map's last known viewport size will be used.
10662   * @return {import("./extent.js").Extent} Extent.
10663   */
10664  calculateExtentInternal(t) {
10665    t = t || this.getViewportSizeMinusPadding_();
10666    const i = (
10667      /** @type {!import("./coordinate.js").Coordinate} */
10668      this.getCenterInternal()
10669    );
10670    at(i, 1);
10671    const s = (
10672      /** @type {!number} */
10673      this.getResolution()
10674    );
10675    at(s !== void 0, 2);
10676    const n = (
10677      /** @type {!number} */
10678      this.getRotation()
10679    );
10680    return at(n !== void 0, 3), on(i, s, n, t);
10681  }
10682  /**
10683   * Get the maximum resolution of the view.
10684   * @return {number} The maximum resolution of the view.
10685   * @api
10686   */
10687  getMaxResolution() {
10688    return this.maxResolution_;
10689  }
10690  /**
10691   * Get the minimum resolution of the view.
10692   * @return {number} The minimum resolution of the view.
10693   * @api
10694   */
10695  getMinResolution() {
10696    return this.minResolution_;
10697  }
10698  /**
10699   * Get the maximum zoom level for the view.
10700   * @return {number} The maximum zoom level.
10701   * @api
10702   */
10703  getMaxZoom() {
10704    return (
10705      /** @type {number} */
10706      this.getZoomForResolution(this.minResolution_)
10707    );
10708  }
10709  /**
10710   * Set a new maximum zoom level for the view.
10711   * @param {number} zoom The maximum zoom level.
10712   * @api
10713   */
10714  setMaxZoom(t) {
10715    this.applyOptions_(this.getUpdatedOptions_({ maxZoom: t }));
10716  }
10717  /**
10718   * Get the minimum zoom level for the view.
10719   * @return {number} The minimum zoom level.
10720   * @api
10721   */
10722  getMinZoom() {
10723    return (
10724      /** @type {number} */
10725      this.getZoomForResolution(this.maxResolution_)
10726    );
10727  }
10728  /**
10729   * Set a new minimum zoom level for the view.
10730   * @param {number} zoom The minimum zoom level.
10731   * @api
10732   */
10733  setMinZoom(t) {
10734    this.applyOptions_(this.getUpdatedOptions_({ minZoom: t }));
10735  }
10736  /**
10737   * Set whether the view should allow intermediary zoom levels.
10738   * @param {boolean} enabled Whether the resolution is constrained.
10739   * @api
10740   */
10741  setConstrainResolution(t) {
10742    this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: t }));
10743  }
10744  /**
10745   * Get the view projection.
10746   * @return {import("./proj/Projection.js").default} The projection of the view.
10747   * @api
10748   */
10749  getProjection() {
10750    return this.projection_;
10751  }
10752  /**
10753   * Get the view resolution.
10754   * @return {number|undefined} The resolution of the view.
10755   * @observable
10756   * @api
10757   */
10758  getResolution() {
10759    return (
10760      /** @type {number|undefined} */
10761      this.get(Le.RESOLUTION)
10762    );
10763  }
10764  /**
10765   * Get the resolutions for the view. This returns the array of resolutions
10766   * passed to the constructor of the View, or undefined if none were given.
10767   * @return {Array<number>|undefined} The resolutions of the view.
10768   * @api
10769   */
10770  getResolutions() {
10771    return this.resolutions_;
10772  }
10773  /**
10774   * Get the resolution for a provided extent (in map units) and size (in pixels).
10775   * @param {import("./extent.js").Extent} extent Extent.
10776   * @param {import("./size.js").Size} [size] Box pixel size.
10777   * @return {number} The resolution at which the provided extent will render at
10778   *     the given size.
10779   * @api
10780   */
10781  getResolutionForExtent(t, i) {
10782    return this.getResolutionForExtentInternal(
10783      He(t, this.getProjection()),
10784      i
10785    );
10786  }
10787  /**
10788   * Get the resolution for a provided extent (in map units) and size (in pixels).
10789   * @param {import("./extent.js").Extent} extent Extent.
10790   * @param {import("./size.js").Size} [size] Box pixel size.
10791   * @return {number} The resolution at which the provided extent will render at
10792   *     the given size.
10793   */
10794  getResolutionForExtentInternal(t, i) {
10795    i = i || this.getViewportSizeMinusPadding_();
10796    const s = mt(t) / i[0], n = Yt(t) / i[1];
10797    return Math.max(s, n);
10798  }
10799  /**
10800   * Return a function that returns a value between 0 and 1 for a
10801   * resolution. Exponential scaling is assumed.
10802   * @param {number} [power] Power.
10803   * @return {function(number): number} Resolution for value function.
10804   */
10805  getResolutionForValueFunction(t) {
10806    t = t || 2;
10807    const i = this.getConstrainedResolution(this.maxResolution_), s = this.minResolution_, n = Math.log(i / s) / Math.log(t);
10808    return (
10809      /**
10810       * @param {number} value Value.
10811       * @return {number} Resolution.
10812       */
10813      function(r) {
10814        return i / Math.pow(t, r * n);
10815      }
10816    );
10817  }
10818  /**
10819   * Get the view rotation.
10820   * @return {number} The rotation of the view in radians.
10821   * @observable
10822   * @api
10823   */
10824  getRotation() {
10825    return (
10826      /** @type {number} */
10827      this.get(Le.ROTATION)
10828    );
10829  }
10830  /**
10831   * Return a function that returns a resolution for a value between
10832   * 0 and 1. Exponential scaling is assumed.
10833   * @param {number} [power] Power.
10834   * @return {function(number): number} Value for resolution function.
10835   */
10836  getValueForResolutionFunction(t) {
10837    const i = Math.log(t || 2), s = this.getConstrainedResolution(this.maxResolution_), n = this.minResolution_, r = Math.log(s / n) / i;
10838    return (
10839      /**
10840       * @param {number} resolution Resolution.
10841       * @return {number} Value.
10842       */
10843      function(o) {
10844        return Math.log(s / o) / i / r;
10845      }
10846    );
10847  }
10848  /**
10849   * Returns the size of the viewport minus padding.
10850   * @private
10851   * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
10852   * @return {import("./size.js").Size} Viewport size reduced by the padding.
10853   */
10854  getViewportSizeMinusPadding_(t) {
10855    let i = this.getViewportSize_(t);
10856    const s = this.padding_;
10857    return s && (i = [
10858      i[0] - s[1] - s[3],
10859      i[1] - s[0] - s[2]
10860    ]), i;
10861  }
10862  /**
10863   * @return {State} View state.
10864   */
10865  getState() {
10866    const t = this.getProjection(), i = this.getResolution(), s = this.getRotation();
10867    let n = (
10868      /** @type {import("./coordinate.js").Coordinate} */
10869      this.getCenterInternal()
10870    );
10871    const r = this.padding_;
10872    if (r) {
10873      const o = this.getViewportSizeMinusPadding_();
10874      n = Na(
10875        n,
10876        this.getViewportSize_(),
10877        [o[0] / 2 + r[3], o[1] / 2 + r[0]],
10878        i,
10879        s
10880      );
10881    }
10882    return {
10883      center: n.slice(0),
10884      projection: t !== void 0 ? t : null,
10885      resolution: i,
10886      nextCenter: this.nextCenter_,
10887      nextResolution: this.nextResolution_,
10888      nextRotation: this.nextRotation_,
10889      rotation: s,
10890      zoom: this.getZoom()
10891    };
10892  }
10893  /**
10894   * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.
10895   */
10896  getViewStateAndExtent() {
10897    return {
10898      viewState: this.getState(),
10899      extent: this.calculateExtent()
10900    };
10901  }
10902  /**
10903   * Get the current zoom level. This method may return non-integer zoom levels
10904   * if the view does not constrain the resolution, or if an interaction or
10905   * animation is underway.
10906   * @return {number|undefined} Zoom.
10907   * @api
10908   */
10909  getZoom() {
10910    let t;
10911    const i = this.getResolution();
10912    return i !== void 0 && (t = this.getZoomForResolution(i)), t;
10913  }
10914  /**
10915   * Get the zoom level for a resolution.
10916   * @param {number} resolution The resolution.
10917   * @return {number|undefined} The zoom level for the provided resolution.
10918   * @api
10919   */
10920  getZoomForResolution(t) {
10921    let i = this.minZoom_ || 0, s, n;
10922    if (this.resolutions_) {
10923      const r = ua(this.resolutions_, t, 1);
10924      i = r, s = this.resolutions_[r], r == this.resolutions_.length - 1 ? n = 2 : n = s / this.resolutions_[r + 1];
10925    } else
10926      s = this.maxResolution_, n = this.zoomFactor_;
10927    return i + Math.log(s / t) / Math.log(n);
10928  }
10929  /**
10930   * Get the resolution for a zoom level.
10931   * @param {number} zoom Zoom level.
10932   * @return {number} The view resolution for the provided zoom level.
10933   * @api
10934   */
10935  getResolutionForZoom(t) {
10936    if (this.resolutions_) {
10937      if (this.resolutions_.length <= 1)
10938        return 0;
10939      const i = Ot(
10940        Math.floor(t),
10941        0,
10942        this.resolutions_.length - 2
10943      ), s = this.resolutions_[i] / this.resolutions_[i + 1];
10944      return this.resolutions_[i] / Math.pow(s, Ot(t - i, 0, 1));
10945    }
10946    return this.maxResolution_ / Math.pow(this.zoomFactor_, t - this.minZoom_);
10947  }
10948  /**
10949   * Fit the given geometry or extent based on the given map size and border.
10950   * The size is pixel dimensions of the box to fit the extent into.
10951   * In most cases you will want to use the map size, that is `map.getSize()`.
10952   * Takes care of the map angle.
10953   * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
10954   *     extent to fit the view to.
10955   * @param {FitOptions} [options] Options.
10956   * @api
10957   */
10958  fit(t, i) {
10959    let s;
10960    if (at(
10961      Array.isArray(t) || typeof /** @type {?} */
10962      t.getSimplifiedGeometry == "function",
10963      24
10964    ), Array.isArray(t)) {
10965      at(!Is(t), 25);
10966      const n = He(t, this.getProjection());
10967      s = Iu(n);
10968    } else if (t.getType() === "Circle") {
10969      const n = He(
10970        t.getExtent(),
10971        this.getProjection()
10972      );
10973      s = Iu(n), s.rotate(this.getRotation(), ii(n));
10974    } else
10975      s = t;
10976    this.fitInternal(s, i);
10977  }
10978  /**
10979   * Calculate rotated extent
10980   * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
10981   * @return {import("./extent").Extent} The rotated extent for the geometry.
10982   */
10983  rotatedExtentForGeometry(t) {
10984    const i = this.getRotation(), s = Math.cos(i), n = Math.sin(-i), r = t.getFlatCoordinates(), o = t.getStride();
10985    let a = 1 / 0, l = 1 / 0, h = -1 / 0, c = -1 / 0;
10986    for (let u = 0, d = r.length; u < d; u += o) {
10987      const f = r[u] * s - r[u + 1] * n, g = r[u] * n + r[u + 1] * s;
10988      a = Math.min(a, f), l = Math.min(l, g), h = Math.max(h, f), c = Math.max(c, g);
10989    }
10990    return [a, l, h, c];
10991  }
10992  /**
10993   * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
10994   * @param {FitOptions} [options] Options.
10995   */
10996  fitInternal(t, i) {
10997    i = i || {};
10998    let s = i.size;
10999    s || (s = this.getViewportSizeMinusPadding_());
11000    const n = i.padding !== void 0 ? i.padding : [0, 0, 0, 0], r = i.nearest !== void 0 ? i.nearest : !1;
11001    let o;
11002    i.minResolution !== void 0 ? o = i.minResolution : i.maxZoom !== void 0 ? o = this.getResolutionForZoom(i.maxZoom) : o = 0;
11003    const a = this.rotatedExtentForGeometry(t);
11004    let l = this.getResolutionForExtentInternal(a, [
11005      s[0] - n[1] - n[3],
11006      s[1] - n[0] - n[2]
11007    ]);
11008    l = isNaN(l) ? o : Math.max(l, o), l = this.getConstrainedResolution(l, r ? 0 : 1);
11009    const h = this.getRotation(), c = Math.sin(h), u = Math.cos(h), d = ii(a);
11010    d[0] += (n[1] - n[3]) / 2 * l, d[1] += (n[0] - n[2]) / 2 * l;
11011    const f = d[0] * u - d[1] * c, g = d[1] * u + d[0] * c, _ = this.getConstrainedCenter([f, g], l), m = i.callback ? i.callback : Mn;
11012    i.duration !== void 0 ? this.animateInternal(
11013      {
11014        resolution: l,
11015        center: _,
11016        duration: i.duration,
11017        easing: i.easing
11018      },
11019      m
11020    ) : (this.targetResolution_ = l, this.targetCenter_ = _, this.applyTargetState_(!1, !0), Hr(m, !0));
11021  }
11022  /**
11023   * Center on coordinate and view position.
11024   * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
11025   * @param {import("./size.js").Size} size Box pixel size.
11026   * @param {import("./pixel.js").Pixel} position Position on the view to center on.
11027   * @api
11028   */
11029  centerOn(t, i, s) {
11030    this.centerOnInternal(
11031      Pt(t, this.getProjection()),
11032      i,
11033      s
11034    );
11035  }
11036  /**
11037   * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
11038   * @param {import("./size.js").Size} size Box pixel size.
11039   * @param {import("./pixel.js").Pixel} position Position on the view to center on.
11040   */
11041  centerOnInternal(t, i, s) {
11042    this.setCenterInternal(
11043      Na(
11044        t,
11045        i,
11046        s,
11047        this.getResolution(),
11048        this.getRotation()
11049      )
11050    );
11051  }
11052  /**
11053   * Calculates the shift between map and viewport center.
11054   * @param {import("./coordinate.js").Coordinate} center Center.
11055   * @param {number} resolution Resolution.
11056   * @param {number} rotation Rotation.
11057   * @param {import("./size.js").Size} size Size.
11058   * @return {Array<number>|undefined} Center shift.
11059   */
11060  calculateCenterShift(t, i, s, n) {
11061    let r;
11062    const o = this.padding_;
11063    if (o && t) {
11064      const a = this.getViewportSizeMinusPadding_(-s), l = Na(
11065        t,
11066        n,
11067        [a[0] / 2 + o[3], a[1] / 2 + o[0]],
11068        i,
11069        s
11070      );
11071      r = [
11072        t[0] - l[0],
11073        t[1] - l[1]
11074      ];
11075    }
11076    return r;
11077  }
11078  /**
11079   * @return {boolean} Is defined.
11080   */
11081  isDef() {
11082    return !!this.getCenterInternal() && this.getResolution() !== void 0;
11083  }
11084  /**
11085   * Adds relative coordinates to the center of the view. Any extent constraint will apply.
11086   * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
11087   * @api
11088   */
11089  adjustCenter(t) {
11090    const i = Cs(this.targetCenter_, this.getProjection());
11091    this.setCenter([
11092      i[0] + t[0],
11093      i[1] + t[1]
11094    ]);
11095  }
11096  /**
11097   * Adds relative coordinates to the center of the view. Any extent constraint will apply.
11098   * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
11099   */
11100  adjustCenterInternal(t) {
11101    const i = this.targetCenter_;
11102    this.setCenterInternal([
11103      i[0] + t[0],
11104      i[1] + t[1]
11105    ]);
11106  }
11107  /**
11108   * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
11109   * constraint will apply.
11110   * @param {number} ratio The ratio to apply on the view resolution.
11111   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11112   * @api
11113   */
11114  adjustResolution(t, i) {
11115    i = i && Pt(i, this.getProjection()), this.adjustResolutionInternal(t, i);
11116  }
11117  /**
11118   * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
11119   * constraint will apply.
11120   * @param {number} ratio The ratio to apply on the view resolution.
11121   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11122   */
11123  adjustResolutionInternal(t, i) {
11124    const s = this.getAnimating() || this.getInteracting(), n = this.getViewportSize_(this.getRotation()), r = this.constraints_.resolution(
11125      this.targetResolution_ * t,
11126      0,
11127      n,
11128      s
11129    );
11130    i && (this.targetCenter_ = this.calculateCenterZoom(r, i)), this.targetResolution_ *= t, this.applyTargetState_();
11131  }
11132  /**
11133   * Adds a value to the view zoom level, optionally using an anchor. Any resolution
11134   * constraint will apply.
11135   * @param {number} delta Relative value to add to the zoom level.
11136   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11137   * @api
11138   */
11139  adjustZoom(t, i) {
11140    this.adjustResolution(Math.pow(this.zoomFactor_, -t), i);
11141  }
11142  /**
11143   * Adds a value to the view rotation, optionally using an anchor. Any rotation
11144   * constraint will apply.
11145   * @param {number} delta Relative value to add to the zoom rotation, in radians.
11146   * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
11147   * @api
11148   */
11149  adjustRotation(t, i) {
11150    i && (i = Pt(i, this.getProjection())), this.adjustRotationInternal(t, i);
11151  }
11152  /**
11153   * @param {number} delta Relative value to add to the zoom rotation, in radians.
11154   * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
11155   */
11156  adjustRotationInternal(t, i) {
11157    const s = this.getAnimating() || this.getInteracting(), n = this.constraints_.rotation(
11158      this.targetRotation_ + t,
11159      s
11160    );
11161    i && (this.targetCenter_ = this.calculateCenterRotate(n, i)), this.targetRotation_ += t, this.applyTargetState_();
11162  }
11163  /**
11164   * Set the center of the current view. Any extent constraint will apply.
11165   * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
11166   * @observable
11167   * @api
11168   */
11169  setCenter(t) {
11170    this.setCenterInternal(
11171      t && Pt(t, this.getProjection())
11172    );
11173  }
11174  /**
11175   * Set the center using the view projection (not the user projection).
11176   * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
11177   */
11178  setCenterInternal(t) {
11179    this.targetCenter_ = t, this.applyTargetState_();
11180  }
11181  /**
11182   * @param {import("./ViewHint.js").default} hint Hint.
11183   * @param {number} delta Delta.
11184   * @return {number} New value.
11185   */
11186  setHint(t, i) {
11187    return this.hints_[t] += i, this.changed(), this.hints_[t];
11188  }
11189  /**
11190   * Set the resolution for this view. Any resolution constraint will apply.
11191   * @param {number|undefined} resolution The resolution of the view.
11192   * @observable
11193   * @api
11194   */
11195  setResolution(t) {
11196    this.targetResolution_ = t, this.applyTargetState_();
11197  }
11198  /**
11199   * Set the rotation for this view. Any rotation constraint will apply.
11200   * @param {number} rotation The rotation of the view in radians.
11201   * @observable
11202   * @api
11203   */
11204  setRotation(t) {
11205    this.targetRotation_ = t, this.applyTargetState_();
11206  }
11207  /**
11208   * Zoom to a specific zoom level. Any resolution constrain will apply.
11209   * @param {number} zoom Zoom level.
11210   * @api
11211   */
11212  setZoom(t) {
11213    this.setResolution(this.getResolutionForZoom(t));
11214  }
11215  /**
11216   * Recompute rotation/resolution/center based on target values.
11217   * Note: we have to compute rotation first, then resolution and center considering that
11218   * parameters can influence one another in case a view extent constraint is present.
11219   * @param {boolean}
11219 [doNotCancelAnims] Do not cancel animations.
11220   * @param {boolean} [forceMoving] Apply constraints as if the view is moving.
11221   * @private
11222   */
11223  applyTargetState_(t, i) {
11224    const s = this.getAnimating() || this.getInteracting() || i, n = this.constraints_.rotation(
11225      this.targetRotation_,
11226      s
11227    ), r = this.getViewportSize_(n), o = this.constraints_.resolution(
11228      this.targetResolution_,
11229      0,
11230      r,
11231      s
11232    ), a = this.constraints_.center(
11233      this.targetCenter_,
11234      o,
11235      r,
11236      s,
11237      this.calculateCenterShift(
11238        this.targetCenter_,
11239        o,
11240        n,
11241        r
11242      )
11243    );
11244    this.get(Le.ROTATION) !== n && this.set(Le.ROTATION, n), this.get(Le.RESOLUTION) !== o && (this.set(Le.RESOLUTION, o), this.set("zoom", this.getZoom(), !0)), (!a || !this.get(Le.CENTER) || !Fe(this.get(Le.CENTER), a)) && this.set(Le.CENTER, a), this.getAnimating() && !t && this.cancelAnimations(), this.cancelAnchor_ = void 0;
11245  }
11246  /**
11247   * If any constraints need to be applied, an animation will be triggered.
11248   * This is typically done on interaction end.
11249   * Note: calling this with a duration of 0 will apply the constrained values straight away,
11250   * without animation.
11251   * @param {number} [duration] The animation duration in ms.
11252   * @param {number} [resolutionDirection] Which direction to zoom.
11253   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11254   */
11255  resolveConstraints(t, i, s) {
11256    t = t !== void 0 ? t : 200;
11257    const n = i || 0, r = this.constraints_.rotation(this.targetRotation_), o = this.getViewportSize_(r), a = this.constraints_.resolution(
11258      this.targetResolution_,
11259      n,
11260      o
11261    ), l = this.constraints_.center(
11262      this.targetCenter_,
11263      a,
11264      o,
11265      !1,
11266      this.calculateCenterShift(
11267        this.targetCenter_,
11268        a,
11269        r,
11270        o
11271      )
11272    );
11273    if (t === 0 && !this.cancelAnchor_) {
11274      this.targetResolution_ = a, this.targetRotation_ = r, this.targetCenter_ = l, this.applyTargetState_();
11275      return;
11276    }
11277    s = s || (t === 0 ? this.cancelAnchor_ : void 0), this.cancelAnchor_ = void 0, (this.getResolution() !== a || this.getRotation() !== r || !this.getCenterInternal() || !Fe(this.getCenterInternal(), l)) && (this.getAnimating() && this.cancelAnimations(), this.animateInternal({
11278      rotation: r,
11279      center: l,
11280      resolution: a,
11281      duration: t,
11282      easing: Pn,
11283      anchor: s
11284    }));
11285  }
11286  /**
11287   * Notify the View that an interaction has started.
11288   * The view state will be resolved to a stable one if needed
11289   * (depending on its constraints).
11290   * @api
11291   */
11292  beginInteraction() {
11293    this.resolveConstraints(0), this.setHint(Xt.INTERACTING, 1);
11294  }
11295  /**
11296   * Notify the View that an interaction has ended. The view state will be resolved
11297   * to a stable one if needed (depending on its constraints).
11298   * @param {number} [duration] Animation duration in ms.
11299   * @param {number} [resolutionDirection] Which direction to zoom.
11300   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11301   * @api
11302   */
11303  endInteraction(t, i, s) {
11304    s = s && Pt(s, this.getProjection()), this.endInteractionInternal(t, i, s);
11305  }
11306  /**
11307   * Notify the View that an interaction has ended. The view state will be resolved
11308   * to a stable one if needed (depending on its constraints).
11309   * @param {number} [duration] Animation duration in ms.
11310   * @param {number} [resolutionDirection] Which direction to zoom.
11311   * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
11312   */
11313  endInteractionInternal(t, i, s) {
11314    this.getInteracting() && (this.setHint(Xt.INTERACTING, -1), this.resolveConstraints(t, i, s));
11315  }
11316  /**
11317   * Get a valid position for the view center according to the current constraints.
11318   * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position.
11319   * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.
11320   * This is useful to guess a valid center position at a different zoom level.
11321   * @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
11322   */
11323  getConstrainedCenter(t, i) {
11324    const s = this.getViewportSize_(this.getRotation());
11325    return this.constraints_.center(
11326      t,
11327      i || this.getResolution(),
11328      s
11329    );
11330  }
11331  /**
11332   * Get a valid zoom level according to the current view constraints.
11333   * @param {number|undefined} targetZoom Target zoom.
11334   * @param {number} [direction=0] Indicate which resolution should be used
11335   * by a renderer if the view resolution does not match any resolution of the tile source.
11336   * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
11337   * will be used. If -1, the nearest higher resolution will be used.
11338   * @return {number|undefined} Valid zoom level.
11339   */
11340  getConstrainedZoom(t, i) {
11341    const s = this.getResolutionForZoom(t);
11342    return this.getZoomForResolution(
11343      this.getConstrainedResolution(s, i)
11344    );
11345  }
11346  /**
11347   * Get a valid resolution according to the current view constraints.
11348   * @param {number|undefined} targetResolution Target resolution.
11349   * @param {number} [direction=0] Indicate which resolution should be used
11350   * by a renderer if the view resolution does not match any resolution of the tile source.
11351   * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
11352   * will be used. If -1, the nearest higher resolution will be used.
11353   * @return {number|undefined} Valid resolution.
11354   */
11355  getConstrainedResolution(t, i) {
11356    i = i || 0;
11357    const s = this.getViewportSize_(this.getRotation());
11358    return this.constraints_.resolution(t, i, s);
11359  }
11360}
11361function Hr(e, t) {
11362  setTimeout(function() {
11363    e(t);
11364  }, 0);
11365}
11366function nM(e) {
11367  if (e.extent !== void 0) {
11368    const i = e.smoothExtentConstraint !== void 0 ? e.smoothExtentConstraint : !0;
11369    return Mu(e.extent, e.constrainOnlyCenter, i);
11370  }
11371  const t = th(e.projection, "EPSG:3857");
11372  if (e.multiWorld !== !0 && t.isGlobal()) {
11373    const i = t.getExtent().slice();
11374    return i[0] = -1 / 0, i[2] = 1 / 0, Mu(i, !1, !1);
11375  }
11376  return IE;
11377}
11378function rM(e) {
11379  let t, i, s, o = e.minZoom !== void 0 ? e.minZoom : Da, a = e.maxZoom !== void 0 ? e.maxZoom : 28;
11380  const l = e.zoomFactor !== void 0 ? e.zoomFactor : 2, h = e.multiWorld !== void 0 ? e.multiWorld : !1, c = e.smoothResolutionConstraint !== void 0 ? e.smoothResolutionConstraint : !0, u = e.showFullExtent !== void 0 ? e.showFullExtent : !1, d = th(e.projection, "EPSG:3857"), f = d.getExtent();
11381  let g = e.constrainOnlyCenter, _ = e.extent;
11382  if (!h && !_ && d.isGlobal() && (g = !1, _ = f), e.resolutions !== void 0) {
11383    const m = e.resolutions;
11384    i = m[o], s = m[a] !== void 0 ? m[a] : m[m.length - 1], e.constrainResolution ? t = PE(
11385      m,
11386      c,
11387      !g && _,
11388      u
11389    ) : t = Cu(
11390      i,
11391      s,
11392      c,
11393      !g && _,
11394      u
11395    );
11396  } else {
11397    const p = (f ? Math.max(mt(f), Yt(f)) : (
11398      // use an extent that can fit the whole world if need be
11399      360 * sr.degrees / d.getMetersPerUnit()
11400    )) / Sh / Math.pow(2, Da), y = p / Math.pow(2, 28 - Da);
11401    i = e.maxResolution, i !== void 0 ? o = 0 : i = p / Math.pow(l, o), s = e.minResolution, s === void 0 && (e.maxZoom !== void 0 ? e.maxResolution !== void 0 ? s = i / Math.pow(l, a) : s = p / Math.pow(l, a) : s = y), a = o + Math.floor(
11402      Math.log(i / s) / Math.log(l)
11403    ), s = i / Math.pow(l, a - o), e.constrainResolution ? t = AE(
11404      l,
11405      i,
11406      s,
11407      c,
11408      !g && _,
11409      u
11410    ) : t = Cu(
11411      i,
11412      s,
11413      c,
11414      !g && _,
11415      u
11416    );
11417  }
11418  return {
11419    constraint: t,
11420    maxResolution: i,
11421    minResolution: s,
11422    minZoom: o,
11423    zoomFactor: l
11424  };
11425}
11426function oM(e) {
11427  if (e.enableRotation !== void 0 ? e.enableRotation : !0) {
11428    const i = e.constrainRotation;
11429    return i === void 0 || i === !0 ? OE() : i === !1 ? bu : typeof i == "number" ? LE(i) : bu;
11430  }
11431  return Ih;
11432}
11433function aM(e) {
11434  return !(e.sourceCenter && e.targetCenter && !Fe(e.sourceCenter, e.targetCenter) || e.sourceResolution !== e.targetResolution || e.sourceRotation !== e.targetRotation);
11435}
11436function Na(e, t, i, s, n) {
11437  const r = Math.cos(-n);
11438  let o = Math.sin(-n), a = e[0] * r - e[1] * o, l = e[1] * r + e[0] * o;
11439  a += (t[0] / 2 - i[0]) * s, l += (i[1] - t[1] / 2) * s, o = -o;
11440  const h = a * r - l * o, c = l * r + a * o;
11441  return [h, c];
11442}
11443const qe = sM;
11444class lM extends Jf {
11445  /**
11446   * @param {Options<SourceType>} options Layer options.
11447   */
11448  constructor(t) {
11449    const i = Object.assign({}, t);
11450    delete i.source, super(i), this.on, this.once, this.un, this.mapPrecomposeKey_ = null, this.mapRenderKey_ = null, this.sourceChangeKey_ = null, this.renderer_ = null, this.sourceReady_ = !1, this.rendered = !1, t.render && (this.render = t.render), t.map && this.setMap(t.map), this.addChangeListener(
11451      Et.SOURCE,
11452      this.handleSourcePropertyChange_
11453    );
11454    const s = t.source ? (
11455      /** @type {SourceType} */
11456      t.source
11457    ) : null;
11458    this.setSource(s);
11459  }
11460  /**
11461   * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be modified in place).
11462   * @return {Array<import("./Layer.js").default>} Array of layers.
11463   */
11464  getLayersArray(t) {
11465    return t = t || [], t.push(this), t;
11466  }
11467  /**
11468   * @param {Array<import("./Layer.js").State>} [states] Optional list of layer states (to be modified in place).
11469   * @return {Array<import("./Layer.js").State>} List of layer states.
11470   */
11471  getLayerStatesArray(t) {
11472    return t = t || [], t.push(this.getLayerState()), t;
11473  }
11474  /**
11475   * Get the layer source.
11476   * @return {SourceType|null} The layer source (or `null` if not yet set).
11477   * @observable
11478   * @api
11479   */
11480  getSource() {
11481    return (
11482      /** @type {SourceType} */
11483      this.get(Et.SOURCE) || null
11484    );
11485  }
11486  /**
11487   * @return {SourceType|null} The source being rendered.
11488   */
11489  getRenderSource() {
11490    return this.getSource();
11491  }
11492  /**
11493   * @return {import("../source/Source.js").State} Source state.
11494   */
11495  getSourceState() {
11496    const t = this.getSource();
11497    return t ? t.getState() : "undefined";
11498  }
11499  /**
11500   * @private
11501   */
11502  handleSourceChange_() {
11503    this.changed(), !(this.sourceReady_ || this.getSource().getState() !== "ready") && (this.sourceReady_ = !0, this.dispatchEvent("sourceready"));
11504  }
11505  /**
11506   * @private
11507   */
11508  handleSourcePropertyChange_() {
11509    this.sourceChangeKey_ && (Mt(this.sourceChangeKey_), this.sourceChangeKey_ = null), this.sourceReady_ = !1;
11510    const t = this.getSource();
11511    t && (this.sourceChangeKey_ = lt(
11512      t,
11513      et.CHANGE,
11514      this.handleSourceChange_,
11515      this
11516    ), t.getState() === "ready" && (this.sourceReady_ = !0, setTimeout(() => {
11517      this.dispatchEvent("sourceready");
11518    }, 0))), this.changed();
11519  }
11520  /**
11521   * @param {import("../pixel").Pixel} pixel Pixel.
11522   * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
11523   * an array of features.
11524   */
11525  getFeatures(t) {
11526    return this.renderer_ ? this.renderer_.getFeatures(t) : Promise.resolve([]);
11527  }
11528  /**
11529   * @param {import("../pixel").Pixel} pixel Pixel.
11530   * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
11531   */
11532  getData(t) {
11533    return !this.renderer_ || !this.rendered ? null : this.renderer_.getData(t);
11534  }
11535  /**
11536   * The layer is visible on the map view, i.e. within its min/max resolution or zoom and
11537   * extent, not set to `visible: false`, and not inside a layer group that is set
11538   * to `visible: false`.
11539   * @param {View|import("../View.js").ViewStateLayerStateExtent} [view] View or {@link import("../Map.js").FrameState}.
11540   * Only required when the layer is not added to a map.
11541   * @return {boolean} The layer is visible in the map view.
11542   * @api
11543   */
11544  isVisible(t) {
11545    let i;
11546    const s = this.getMapInternal();
11547    !t && s && (t = s.getView()), t instanceof qe ? i = {
11548      viewState: t.getState(),
11549      extent: t.calculateExtent()
11550    } : i = t, !i.layerStatesArray && s && (i.layerStatesArray = s.getLayerGroup().getLayerStatesArray());
11551    let n;
11552    i.layerStatesArray ? n = i.layerStatesArray.find(
11553      (o) => o.layer === this
11554    ) : n = this.getLayerState();
11555    const r = this.getExtent();
11556    return zh(n, i.viewState) && (!r || ee(r, i.extent));
11557  }
11558  /**
11559   * Get the attributions of the source of this layer for the given view.
11560   * @param {View|import("../View.js").ViewStateLayerStateExtent} [view] View or {@link import("../Map.js").FrameState}.
11561   * Only required when the layer is not added to a map.
11562   * @return {Array<string>} Attributions for this layer at the given view.
11563   * @api
11564   */
11565  getAttributions(t) {
11566    if (!this.isVisible(t))
11567      return [];
11568    let i;
11569    const s = this.getSource();
11570    if (s && (i = s.getAttributions()), !i)
11571      return [];
11572    const n = t instanceof qe ? t.getViewStateAndExtent() : t;
11573    let r = i(n);
11574    return Array.isArray(r) || (r = [r]), r;
11575  }
11576  /**
11577   * In charge to manage the rendering of the layer. One layer type is
11578   * bounded with one layer renderer.
11579   * @param {?import("../Map.js").FrameState} frameState Frame state.
11580   * @param {HTMLElement} target Target which the renderer may (but need not) use
11581   * for rendering its content.
11582   * @return {HTMLElement|null} The rendered element.
11583   */
11584  render(t, i) {
11585    const s = this.getRenderer();
11586    return s.prepareFrame(t) ? (this.rendered = !0, s.renderFrame(t, i)) : null;
11587  }
11588  /**
11589   * Called when a layer is not visible during a map render.
11590   */
11591  unrender() {
11592    this.rendered = !1;
11593  }
11594  /**
11595   * For use inside the library only.
11596   * @param {import("../Map.js").default|null} map Map.
11597   */
11598  setMapInternal(t) {
11599    t || this.unrender(), this.set(Et.MAP, t);
11600  }
11601  /**
11602   * For use inside the library only.
11603   * @return {import("../Map.js").default|null} Map.
11604   */
11605  getMapInternal() {
11606    return this.get(Et.MAP);
11607  }
11608  /**
11609   * Sets the layer to be rendered on top of other layers on a map. The map will
11610   * not manage this layer in its layers collection. This
11611   * is useful for temporary layers. To remove an unmanaged layer from the map,
11612   * use `#setMap(null)`.
11613   *
11614   * To add the layer to a map and have it managed by the map, use
11615   * {@link module:ol/Map~Map#addLayer} instead.
11616   * @param {import("../Map.js").default|null} map Map.
11617   * @api
11618   */
11619  setMap(t) {
11620    this.mapPrecomposeKey_ && (Mt(this.mapPrecomposeKey_), this.mapPrecomposeKey_ = null), t || this.changed(), this.mapRenderKey_ && (Mt(this.mapRenderKey_), this.mapRenderKey_ = null), t && (this.mapPrecomposeKey_ = lt(
11621      t,
11622      Vi.PRECOMPOSE,
11623      function(i) {
11624        const n = /** @type {import("../render/Event.js").default} */ i.frameState.layerStatesArray, r = this.getLayerState(!1);
11625        at(
11626          !n.some(function(o) {
11627            return o.layer === r.layer;
11628          }),
11629          67
11630        ), n.push(r);
11631      },
11632      this
11633    ), this.mapRenderKey_ = lt(this, et.CHANGE, t.render, t), this.changed());
11634  }
11635  /**
11636   * Set the layer source.
11637   * @param {SourceType|null} source The layer source.
11638   * @observable
11639   * @api
11640   */
11641  setSource(t) {
11642    this.set(Et.SOURCE, t);
11643  }
11644  /**
11645   * Get the renderer for this layer.
11646   * @return {RendererType|null} The layer renderer.
11647   */
11648  getRenderer() {
11649    return this.renderer_ || (this.renderer_ = this.createRenderer()), this.renderer_;
11650  }
11651  /**
11652   * @return {boolean} The layer has a renderer.
11653   */
11654  hasRenderer() {
11655    return !!this.renderer_;
11656  }
11657  /**
11658   * Create a renderer for this layer.
11659   * @return {RendererType} A layer renderer.
11660   * @protected
11661   */
11662  createRenderer() {
11663    return null;
11664  }
11665  /**
11666   * Clean up.
11667   */
11668  disposeInternal() {
11669    this.renderer_ && (this.renderer_.dispose(), delete this.renderer_), this.setSource(null), super.disposeInternal();
11670  }
11671}
11672function zh(e, t) {
11673  if (!e.visible)
11674    return !1;
11675  const i = t.resolution;
11676  if (i < e.minResolution || i >= e.maxResolution)
11677    return !1;
11678  const s = t.zoom;
11679  return s > e.minZoom && s <= e.maxZoom;
11680}
11681const Lr = lM;
11682class hM extends Ch {
11683  /**
11684   * @param {import("../Map.js").default} map Map.
11685   */
11686  constructor(t) {
11687    super(), this.map_ = t;
11688  }
11689  /**
11690   * @abstract
11691   * @param {import("../render/EventType.js").default} type Event type.
11692   * @param {import("../Map.js").FrameState} frameState Frame state.
11693   */
11694  dispatchRenderEvent(t, i) {
11695    Z();
11696  }
11697  /**
11698   * @param {import("../Map.js").FrameState} frameState FrameState.
11699   * @protected
11700   */
11701  calculateMatrices2D(t) {
11702    const i = t.viewState, s = t.coordinateToPixelTransform, n = t.pixelToCoordinateTransform;
11703    si(
11704      s,
11705      t.size[0] / 2,
11706      t.size[1] / 2,
11707      1 / i.resolution,
11708      -1 / i.resolution,
11709      -i.rotation,
11710      -i.center[0],
11711      -i.center[1]
11712    ), fa(n, s);
11713  }
11714  /**
11715   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
11716   * @param {import("../Map.js").FrameState} frameState FrameState.
11717   * @param {number} hitTolerance Hit tolerance in pixels.
11718   * @param {boolean} checkWrapped Check for wrapped geometries.
11719   * @param {import("./vector.js").FeatureCallback<T>}
11719 callback Feature callback.
11720   * @param {S} thisArg Value to use as `this` when executing `callback`.
11721   * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
11722   *     function, only layers which are visible and for which this function
11723   *     returns `true` will be tested for features.  By default, all visible
11724   *     layers will be tested.
11725   * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.
11726   * @return {T|undefined} Callback result.
11727   * @template S,T,U
11728   */
11729  forEachFeatureAtCoordinate(t, i, s, n, r, o, a, l) {
11730    let h;
11731    const c = i.viewState;
11732    function u(E, C, w, O) {
11733      return r.call(o, C, E ? w : null, O);
11734    }
11735    const d = c.projection, f = Xd(t.slice(), d), g = [[0, 0]];
11736    if (d.canWrapX() && n) {
11737      const E = d.getExtent(), C = mt(E);
11738      g.push([-C, 0], [C, 0]);
11739    }
11740    const _ = i.layerStatesArray, m = _.length, p = (
11741      /** @type {Array<HitMatch<T>>} */
11742      []
11743    ), y = [];
11744    for (let E = 0; E < g.length; E++)
11745      for (let C = m - 1; C >= 0; --C) {
11746        const w = _[C], O = w.layer;
11747        if (O.hasRenderer() && zh(w, c) && a.call(l, O)) {
11748          const R = O.getRenderer(), j = O.getSource();
11749          if (R && j) {
11750            const $ = j.getWrapX() ? f : t, V = u.bind(
11751              null,
11752              w.managed
11753            );
11754            y[0] = $[0] + g[E][0], y[1] = $[1] + g[E][1], h = R.forEachFeatureAtCoordinate(
11755              y,
11756              i,
11757              s,
11758              V,
11759              p
11760            );
11761          }
11762          if (h)
11763            return h;
11764        }
11765      }
11766    if (p.length === 0)
11767      return;
11768    const v = 1 / p.length;
11769    return p.forEach((E, C) => E.distanceSq += C * v), p.sort((E, C) => E.distanceSq - C.distanceSq), p.some((E) => h = E.callback(E.feature, E.layer, E.geometry)), h;
11770  }
11771  /**
11772   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
11773   * @param {import("../Map.js").FrameState} frameState FrameState.
11774   * @param {number} hitTolerance Hit tolerance in pixels.
11775   * @param {boolean} checkWrapped Check for wrapped geometries.
11776   * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
11777   *     function, only layers which are visible and for which this function
11778   *     returns `true` will be tested for features.  By default, all visible
11779   *     layers will be tested.
11780   * @param {U} thisArg Value to use as `this` when executing `layerFilter`.
11781   * @return {boolean} Is there a feature at the given coordinate?
11782   * @template U
11783   */
11784  hasFeatureAtCoordinate(t, i, s, n, r, o) {
11785    return this.forEachFeatureAtCoordinate(
11786      t,
11787      i,
11788      s,
11789      n,
11790      Ss,
11791      this,
11792      r,
11793      o
11794    ) !== void 0;
11795  }
11796  /**
11797   * @return {import("../Map.js").default} Map.
11798   */
11799  getMap() {
11800    return this.map_;
11801  }
11802  /**
11803   * Render.
11804   * @abstract
11805   * @param {?import("../Map.js").FrameState} frameState Frame state.
11806   */
11807  renderFrame(t) {
11808    Z();
11809  }
11810  /**
11811   * @param {import("../Map.js").FrameState} frameState Frame state.
11812   * @protected
11813   */
11814  scheduleExpireIconCache(t) {
11815    Oo.canExpireCache() && t.postRenderFunctions.push(cM);
11816  }
11817}
11818function cM(e, t) {
11819  Oo.expire();
11820}
11821const uM = hM;
11822class dM extends Ae {
11823  /**
11824   * @param {import("./EventType.js").default} type Type.
11825   * @param {import("../transform.js").Transform} [inversePixelTransform] Transform for
11826   *     CSS pixels to rendered pixels.
11827   * @param {import("../Map.js").FrameState} [frameState] Frame state.
11828   * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [context] Context.
11829   */
11830  constructor(t, i, s, n) {
11831    super(t), this.inversePixelTransform = i, this.frameState = s, this.context = n;
11832  }
11833}
11834const ug = dM, Zr = "ol-hidden", ma = "ol-unselectable", jh = "ol-control", Pu = "ol-collapsed", fM 
11834= new RegExp(
11835  [
11836    "^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)",
11837    "(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)",
11838    "(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)",
11839    "(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?",
11840    "(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))",
11841    "(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",
11842    `?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`
11843  ].join(""),
11844  "i"
11845), Au = [
11846  "style",
11847  "variant",
11848  "weight",
11849  "size",
11850  "lineHeight",
11851  "family"
11852], dg = function(e) {
11853  const t = e.match(fM);
11854  if (!t)
11855    return null;
11856  const i = (
11857    /** @type {FontParameters} */
11858    {
11859      lineHeight: "normal",
11860      size: "1.2em",
11861      style: "normal",
11862      weight: "normal",
11863      variant: "normal"
11864    }
11865  );
11866  for (let s = 0, n = Au.length; s < n; ++s) {
11867    const r = t[s + 1];
11868    r !== void 0 && (i[Au[s]] = r);
11869  }
11870  return i.families = i.family.split(/,\s?/), i;
11871};
11872function re(e, t, i, s) {
11873  let n;
11874  return i && i.length ? n = i.shift() : bh ? n = new OffscreenCanvas(e || 300, t || 300) : n = document.createElement("canvas"), e && (n.width = e), t && (n.height = t), /** @type {CanvasRenderingContext2D} */
11875  n.getContext("2d", s);
11876}
11877function pa(e) {
11878  const t = e.canvas;
11879  t.width = 1, t.height = 1, e.clearRect(0, 0, 1, 1);
11880}
11881function Lu(e, t) {
11882  const i = t.parentNode;
11883  i && i.replaceChild(e, t);
11884}
11885function Il(e) {
11886  return e && e.parentNode ? e.parentNode.removeChild(e) : null;
11887}
11888function gM(e) {
11889  for (; e.lastChild; )
11890    e.removeChild(e.lastChild);
11891}
11892function _M(e, t) {
11893  const i = e.childNodes;
11894  for (let s = 0; ; ++s) {
11895    const n = i[s], r = t[s];
11896    if (!n && !r)
11897      break;
11898    if (n !== r) {
11899      if (!n) {
11900        e.appendChild(r);
11901        continue;
11902      }
11903      if (!r) {
11904        e.removeChild(n), --s;
11905        continue;
11906      }
11907      e.insertBefore(r, n);
11908    }
11909  }
11910}
11911const fg = "10px sans-serif", xi = "#000", Do = "round", ur = [], dr = 0, wn = "round", fr = 10, gr = "#000", _r = "center", No = "middle", ds = [0, 0, 0, 0], mr = 1, hi = new ni();
11912let Us = null, Pl;
11913const Al = {}, mM = function() {
11914  const t = "32px ", i = ["monospace", "serif"], s = i.length, n = "wmytzilWMYTZIL@#/&?$%10";
11915  let r, o;
11916  function a(h, c, u) {
11917    let d = !0;
11918    for (let f = 0; f < s; ++f) {
11919      const g = i[f];
11920      if (o = Go(
11921        h + " " + c + " " + t + g,
11922        n
11923      ), u != g) {
11924        const _ = Go(
11925          h + " " + c + " " + t + u + "," + g,
11926          n
11927        );
11928        d = d && _ != o;
11929      }
11930    }
11931    return !!d;
11932  }
11933  function l() {
11934    let h = !0;
11935    const c = hi.getKeys();
11936    for (let u = 0, d = c.length; u < d; ++u) {
11937      const f = c[u];
11938      hi.get(f) < 100 && (a.apply(this, f.split(`
11939`)) ? (Tr(Al), Us = null, Pl = void 0, hi.set(f, 100)) : (hi.set(f, hi.get(f) + 1, !0), h = !1));
11940    }
11941    h && (clearInterval(r), r = void 0);
11942  }
11943  return function(h) {
11944    const c = dg(h);
11945    if (!c)
11946      return;
11947    const u = c.families;
11948    for (let d = 0, f = u.length; d < f; ++d) {
11949      const g = u[d], _ = c.style + `
11950` + c.weight + `
11951` + g;
11952      hi.get(_) === void 0 && (hi.set(_, 100, !0), a(c.style, c.weight, g) || (hi.set(_, 0, !0), r === void 0 && (r = setInterval(l, 32))));
11953    }
11954  };
11955}(), pM = function() {
11956  let e;
11957  return function(t) {
11958    let i = Al[t];
11959    if (i == null) {
11960      if (bh) {
11961        const s = dg(t), n = gg(t, "Žg");
11962        i = (isNaN(Number(s.lineHeight)) ? 1.2 : Number(s.lineHeight)) * (n.actualBoundingBoxAscent + n.actualBoundingBoxDescent);
11963      } else
11964        e || (e = document.createElement("div"), e.innerHTML = "M", e.style.minHeight = "0", e.style.maxHeight = "none", e.style.height = "auto", e.style.padding = "0", e.style.border = "none", e.style.position = "absolute", e.style.display = "block", e.style.left = "-99999px"), e.style.font = t, document.body.appendChild(e), i = e.offsetHeight, document.body.removeChild(e);
11965      Al[t] = i;
11966    }
11967    return i;
11968  };
11969}();
11970function gg(e, t) {
11971  return Us || (Us = re(1, 1)), e != Pl && (Us.font = e, Pl = Us.font), Us.measureText(t);
11972}
11973function Go(e, t) {
11974  return gg(e, t).width;
11975}
11976function Ou(e, t, i) {
11977  if (t in i)
11978    return i[t];
11979  const s = t.split(`
11980`).reduce((n, r) => Math.max(n, Go(e, r)), 0);
11981  return i[t] = s, s;
11982}
11983function yM(e, t) {
11984  const i = [], s = [], n = [];
11985  let r = 0, o = 0, a = 0, l = 0;
11986  for (let h = 0, c = t.length; h <= c; h += 2) {
11987    const u = t[h];
11988    if (u === `
11989` || h === c) {
11990      r = Math.max(r, o), n.push(o), o = 0, a += l;
11991      continue;
11992    }
11993    const d = t[h + 1] || e.font, f = Go(d, u);
11994    i.push(f), o += f;
11995    const g = pM(d);
11996    s.push(g), l = Math.max(l, g);
11997  }
11998  return { width: r, height: a, widths: i, heights: s, lineWidths: n };
11999}
12000function xM(e, t, i, s, n, r, o, a, l, h, c) {
12001  e.save(), i !== 1 && (e.globalAlpha *= i), t && e.setTransform.apply(e, t), /** @type {*} */
12002  s.contextInstructions ? (e.translate(l, h), e.scale(c[0], c[1]), vM(
12003    /** @type {Label} */
12004    s,
12005    e
12006  )) : c[0] < 0 || c[1] < 0 ? (e.translate(l, h), e.scale(c[0], c[1]), e.drawImage(
12007    /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */
12008    s,
12009    n,
12010    r,
12011    o,
12012    a,
12013    0,
12014    0,
12015    o,
12016    a
12017  )) : e.drawImage(
12018    /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */
12019    s,
12020    n,
12021    r,
12022    o,
12023    a,
12024    l,
12025    h,
12026    o * c[0],
12027    a * c[1]
12028  ), e.restore();
12029}
12030function vM(e, t) {
12031  const i = e.contextInstructions;
12032  for (let s = 0, n = i.length; s < n; s += 2)
12033    Array.isArray(i[s + 1]) ? t[i[s]].apply(
12034      t,
12035      i[s + 1]
12036    ) : t[i[s]] = i[s + 1];
12037}
12038class EM extends uM {
12039  /**
12040   * @param {import("../Map.js").default} map Map.
12041   */
12042  constructor(t) {
12043    super(t), this.fontChangeListenerKey_ = lt(
12044      hi,
12045      En.PROPERTYCHANGE,
12046      t.redrawText.bind(t)
12047    ), this.element_ = document.createElement("div");
12048    const i = this.element_.style;
12049    i.position = "absolute", i.width = "100%", i.height = "100%", i.zIndex = "0", this.element_.className = ma + " ol-layers";
12050    const s = t.getViewport();
12051    s.insertBefore(this.element_, s.firstChild || null), this.children_ = [], this.renderedVisible_ = !0;
12052  }
12053  /**
12054   * @param {import("../render/EventType.js").default} type Event type.
12055   * @param {import("../Map.js").FrameState} frameState Frame state.
12056   */
12057  dispatchRenderEvent(t, i) {
12058    const s = this.getMap();
12059    if (s.hasListener(t)) {
12060      const n = new ug(t, void 0, i);
12061      s.dispatchEvent(n);
12062    }
12063  }
12064  disposeInternal() {
12065    Mt(this.fontChangeListenerKey_), this.element_.parentNode.removeChild(this.element_), super.disposeInternal();
12066  }
12067  /**
12068   * Render.
12069   * @param {?import("../Map.js").FrameState} frameState Frame state.
12070   */
12071  renderFrame(t) {
12072    if (!t) {
12073      this.renderedVisible_ && (this.element_.style.display = "none", this.renderedVisible_ = !1);
12074      return;
12075    }
12076    this.calculateMatrices2D(t), this.dispatchRenderEvent(Vi.PRECOMPOSE, t);
12077    const i = t.layerStatesArray.sort(function(o, a) {
12078      return o.zIndex - a.zIndex;
12079    }), s = t.viewState;
12080    this.children_.length = 0;
12081    const n = [];
12082    let r = null;
12083    for (let o = 0, a = i.length; o < a; ++o) {
12084      const l = i[o];
12085      t.layerIndex = o;
12086      const h = l.layer, c = h.getSourceState();
12087      if (!zh(l, s) || c != "ready" && c != "undefined") {
12088        h.unrender();
12089        continue;
12090      }
12091      const u = h.render(t, r);
12092      u && (u !== r && (this.children_.push(u), r = u), "getDeclutter" in h && n.push(
12093        /** @type {import("../layer/BaseVector.js").default} */
12094        h
12095      ));
12096    }
12097    for (let o = n.length - 1; o >= 0; --o)
12098      n[o].renderDeclutter(t);
12099    _M(this.element_, this.children_), this.dispatchRenderEvent(Vi.POSTCOMPOSE, t), this.renderedVisible_ || (this.element_.style.display = "", this.renderedVisible_ = !0), this.scheduleExpireIconCache(t);
12100  }
12101}
12102const MM = EM;
12103class ki extends Ae {
12104  /**
12105   * @param {EventType} type The event type.
12106   * @param {BaseLayer} layer The layer.
12107   */
12108  constructor(t, i) {
12109    super(t), this.layer = i;
12110  }
12111}
12112const Ga = {
12113  LAYERS: "layers"
12114};
12115class Wh extends Jf {
12116  /**
12117   * @param {Options} [options] Layer options.
12118   */
12119  constructor(t) {
12120    t = t || {};
12121    const i = (
12122      /** @type {Options} */
12123      Object.assign({}, t)
12124    );
12125    delete i.layers;
12126    let s = t.layers;
12127    super(i), this.on, this.once, this.un, this.layersListenerKeys_ = [], this.listenerKeys_ = {}, this.addChangeListener(Ga.LAYERS, this.handleLayersChanged_), s ? Array.isArray(s) ? s = new Pe(s.slice(), { unique: !0 }) : at(typeof /** @type {?} */
12128    s.getArray == "function", 43) : s = new Pe(void 0, { unique: !0 }), this.setLayers(s);
12129  }
12130  /**
12131   * @private
12132   */
12133  handleLayerChange_() {
12134    this.changed();
12135  }
12136  /**
12137   * @private
12138   */
12139  handleLayersChanged_() {
12140    this.layersListenerKeys_.forEach(Mt), this.layersListenerKeys_.length = 0;
12141    const t = this.getLayers();
12142    this.layersListenerKeys_.push(
12143      lt(t, $t.ADD, this.handleLayersAdd_, this),
12144      lt(t, $t.REMOVE, this.handleLayersRemove_, this)
12145    );
12146    for (const s in this.listenerKeys_)
12147      this.listenerKeys_[s].forEach(Mt);
12148    Tr(this.listenerKeys_);
12149    const i = t.getArray();
12150    for (let s = 0, n = i.length; s < n; s++) {
12151      const r = i[s];
12152      this.registerLayerListeners_(r), this.dispatchEvent(new ki("addlayer", r));
12153    }
12154    this.changed();
12155  }
12156  /**
12157   * @param {BaseLayer} layer The layer.
12158   */
12159  registerLayerListeners_(t) {
12160    const i = [
12161      lt(
12162        t,
12163        En.PROPERTYCHANGE,
12164        this.handleLayerChange_,
12165        this
12166      ),
12167      lt(t, et.CHANGE, this.handleLayerChange_, this)
12168    ];
12169    t instanceof Wh && i.push(
12170      lt(t, "addlayer", this.handleLayerGroupAdd_, this),
12171      lt(t, "removelayer", this.handleLayerGroupRemove_, this)
12172    ), this.listenerKeys_[ot(t)] = i;
12173  }
12174  /**
12175   * @param {GroupEvent} event The layer group event.
12176   */
12177  handleLayerGroupAdd_(t) {
12178    this.dispatchEvent(new ki("addlayer", t.layer));
12179  }
12180  /**
12181   * @param {GroupEvent} event The layer group event.
12182   */
12183  handleLayerGroupRemove_(t) {
12184    this.dispatchEvent(new ki("removelayer", t.layer));
12185  }
12186  /**
12187   * @param {import("../Collection.js").CollectionEvent<import("./Base.js").default>} collectionEvent CollectionEvent.
12188   * @private
12189   */
12190  handleLayersAdd_(t) {
12191    const i = t.element;
12192    this.registerLayerListeners_(i), this.dispatchEvent(new ki("addlayer", i)), this.changed();
12193  }
12194  /**
12195   * @param {import("../Collection.js").CollectionEvent<import("./Base.js").default>} collectionEvent CollectionEvent.
12196   * @private
12197   */
12198  handleLayersRemove_(t) {
12199    const i = t.element, s = ot(i);
12200    this.listenerKeys_[s].forEach(Mt), delete this.listenerKeys_[s], this.dispatchEvent(new ki("removelayer", i)), this.changed();
12201  }
12202  /**
12203   * Returns the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}
12204   * in this group.
12205   * @return {!Collection<import("./Base.js").default>} Collection of
12206   *   {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.
12207   * @observable
12208   * @api
12209   */
12210  getLayers() {
12211    return (
12212      /** @type {!Collection<import("./Base.js").default>} */
12213      this.get(Ga.LAYERS)
12214    );
12215  }
12216  /**
12217   * Set the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}
12218   * in this group.
12219   * @param {!Collection<import("./Base.js").default>} layers Collection of
12220   *   {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.
12221   * @observable
12222   * @api
12223   */
12224  setLayers(t) {
12225    const i = this.getLayers();
12226    if (i) {
12227      const s = i.getArray();
12228      for (let n = 0, r = s.length; n < r; ++n)
12229        this.dispatchEvent(new ki("removelayer", s[n]));
12230    }
12231    this.set(Ga.LAYERS, t);
12232  }
12233  /**
12234   * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be modified in place).
12235   * @return {Array<import("./Layer.js").default>} Array of layers.
12236   */
12237  getLayersArray(t) {
12238    return t = t !== void 0 ? t : [], this.getLayers().forEach(function(i) {
12239      i.getLayersArray(t);
12240    }), t;
12241  }
12242  /**
12243   * Get the layer states list and use this groups z-index as the default
12244   * for all layers in this and nested groups, if it is unset at this point.
12245   * If dest is not provided and this group's z-index is undefined
12246   * 0 is used a the default z-index.
12247   * @param {Array<import("./Layer.js").State>} [dest] Optional list
12248   * of layer states (to be modified in place).
12249   * @return {Array<import("./Layer.js").State>} List of layer states.
12250   */
12251  getLayerStatesArray(t) {
12252    const i = t !== void 0 ? t : [], s = i.length;
12253    this.getLayers().forEach(function(o) {
12254      o.getLayerStatesArray(i);
12255    });
12256    const n = this.getLayerState();
12257    let r = n.zIndex;
12258    !t && n.zIndex === void 0 && (r = 0);
12259    for (let o = s, a = i.length; o < a; o++) {
12260      const l = i[o];
12261      l.opacity *= n.opacity, l.visible = l.visible && n.visible, l.maxResolution = Math.min(
12262        l.maxResolution,
12263        n.maxResolution
12264      ), l.minResolution = Math.max(
12265        l.minResolution,
12266        n.minResolution
12267      ), l.minZoom = Math.max(l.minZoom, n.minZoom), l.maxZoom = Math.min(l.maxZoom, n.maxZoom), n.extent !== void 0 && (l.extent !== void 0 ? l.extent = gs(
12268        l.extent,
12269        n.extent
12270      ) : l.extent = n.extent), l.zIndex === void 0 && (l.zIndex = r);
12271    }
12272    return i;
12273  }
12274  /**
12275   * @return {import("../source/Source.js").State} Source state.
12276   */
12277  getSourceState() {
12278    return "ready";
12279  }
12280}
12281const ya = Wh;
12282class CM extends Ae {
12283  /**
12284   * @param {string} type Event type.
12285   * @param {import("./Map.js").default} map Map.
12286   * @param {?import("./Map.js").FrameState} [frameState] Frame state.
12287   */
12288  constructor(t, i, s) {
12289    super(t), this.map = i, this.frameState = s !== void 0 ? s : null;
12290  }
12291}
12292const Xs = CM;
12293class bM extends Xs {
12294  /**
12295   * @param {string} type Event type.
12296   * @param {import("./Map.js").default} map Map.
12297   * @param {EVENT} originalEvent Original event.
12298   * @param {boolean} [dragging] Is the map currently being dragged?
12299   * @param {import("./Map.js").FrameState} [frameState] Frame state.
12300   * @param {Array<PointerEvent>} [activePointers] Active pointers.
12301   */
12302  constructor(t, i, s, n, r, o) {
12303    super(t, i, r), this.originalEvent = s, this.pixel_ = null, this.coordinate_ = null, this.dragging = n !== void 0 ? n : !1, this.activePointers = o;
12304  }
12305  /**
12306   * The map pixel relative to the viewport corresponding to the original event.
12307   * @type {import("./pixel.js").Pixel}
12308   * @api
12309   */
12310  get pixel() {
12311    return this.pixel_ || (this.pixel_ = this.map.getEventPixel(this.originalEvent)), this.pixel_;
12312  }
12313  set pixel(t) {
12314    this.pixel_ = t;
12315  }
12316  /**
12317   * The coordinate corresponding to the original browser event.  This will be in the user
12318   * projection if one is set.  Otherwise it will be in the view projection.
12319   * @type {import("./coordinate.js").Coordinate}
12320   * @api
12321   */
12322  get coordinate() {
12323    return this.coordinate_ || (this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel)), this.coordinate_;
12324  }
12325  set coordinate(t) {
12326    this.coordinate_ = t;
12327  }
12328  /**
12329   * Prevents the default browser action.
12330   * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.
12331   * @api
12332   */
12333  preventDefault() {
12334    super.preventDefault(), "preventDefault" in this.originalEvent && this.originalEvent.preventDefault();
12335  }
12336  /**
12337   * Prevents further propagation of the current event.
12338   * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.
12339   * @api
12340   */
12341  stopPropagation() {
12342    super.stopPropagation(), "stopPropagation" in this.originalEvent && this.originalEvent.stopPropagation();
12343  }
12344}
12345const ui = bM, dt = {
12346  /**
12347   * A true single click with no dragging and no double click. Note that this
12348   * event is delayed by 250 ms to ensure that it is not a double click.
12349   * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick
12350   * @api
12351   */
12352  SINGLECLICK: "singleclick",
12353  /**
12354   * A click with no dragging. A double click will fire two of this.
12355   * @event module:ol/MapBrowserEvent~MapBrowserEvent#click
12356   * @api
12357   */
12358  CLICK: et.CLICK,
12359  /**
12360   * A true double click, with no dragging.
12361   * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick
12362   * @api
12363   */
12364  DBLCLICK: et.DBLCLICK,
12365  /**
12366   * Triggered when a pointer is dragged.
12367   * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag
12368   * @api
12369   */
12370  POINTERDRAG: "pointerdrag",
12371  /**
12372   * Triggered when a pointer is moved. Note that on touch devices this is
12373   * triggered when the map is panned, so is not the same as mousemove.
12374   * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove
12375   * @api
12376   */
12377  POINTERMOVE: "pointermove",
12378  POINTERDOWN: "pointerdown",
12379  POINTERUP: "pointerup",
12380  POINTEROVER: "pointerover",
12381  POINTEROUT: "pointerout",
12382  POINTERENTER: "pointerenter",
12383  POINTERLEAVE: "pointerleave",
12384  POINTERCANCEL: "pointercancel"
12385}, Ll = {
12386  POINTERMOVE: "pointermove",
12387  POINTERDOWN: "pointerdown",
12388  POINTERUP: "pointerup",
12389  POINTEROVER: "pointerover",
12390  POINTEROUT: "pointerout",
12391  POINTERENTER: "pointerenter",
12392  POINTERLEAVE: "pointerleave",
12393  POINTERCANCEL: "pointercancel"
12394};
12395class wM extends Ar {
12396  /**
12397   * @param {import("./Map.js").default} map The map with the viewport to listen to events on.
12398   * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.
12399   */
12400  constructor(t, i) {
12401    super(t), this.map_ = t, this.clickTimeoutId_, this.emulateClicks_ = !1, this.dragging_ = !1, this.dragListenerKeys_ = [], this.moveTolerance_ = i === void 0 ? 1 : i, this.down_ = null;
12402    const s = this.map_.getViewport();
12403    this.activePointers_ = [], this.trackedTouches_ = {}, this.element_ = s, this.pointerdownListenerKey_ = lt(
12404      s,
12405      Ll.POINTERDOWN,
12406      this.handlePointerDown_,
12407      this
12408    ), this.originalPointerMoveEvent_, this.relayedListenerKey_ = lt(
12409      s,
12410      Ll.POINTERMOVE,
12411      this.relayMoveEvent_,
12412      this
12413    ), this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this), this.element_.addEventListener(
12414      et.TOUCHMOVE,
12415      this.boundHandleTouchMove_,
12416      Vf ? { passive: !1 } : !1
12417    );
12418  }
12419  /**
12420   * @param {PointerEvent} pointerEvent Pointer
12421   * event.
12422   * @private
12423   */
12424  emulateClick_(t) {
12425    let i = new ui(
12426      dt.CLICK,
12427      this.map_,
12428      t
12429    );
12430    this.dispatchEvent(i), this.clickTimeoutId_ !== void 0 ? (clearTimeout(this.clickTimeoutId_), this.clickTimeoutId_ = void 0, i = new ui(
12431      dt.DBLCLICK,
12432      this.map_,
12433      t
12434    ), this.dispatchEvent(i)) : this.clickTimeoutId_ = setTimeout(() => {
12435      this.clickTimeoutId_ = void 0;
12436      const s = new ui(
12437        dt.SINGLECLICK,
12438        this.map_,
12439        t
12440      );
12441      this.dispatchEvent(s);
12442    }, 250);
12443  }
12444  /**
12445   * Keeps track on how many pointers are currently active.
12446   *
12447   * @param {PointerEvent} pointerEvent Pointer
12448   * event.
12449   * @private
12450   */
12451  updateActivePointers_(t) {
12452    const i = t, s = i.pointerId;
12453    if (i.type == dt.POINTERUP || i.type == dt.POINTERCANCEL) {
12454      delete this.trackedTouches_[s];
12455      for (const n in this.trackedTouches_)
12456        if (this.trackedTouches_[n].target !== i.target) {
12457          delete this.trackedTouches_[n];
12458          break;
12459        }
12460    } else
12461      (i.type == dt.POINTERDOWN || i.type == dt.POINTERMOVE) && (this.trackedTouches_[s] = i);
12462    this.activePointers_ = Object.values(this.trackedTouches_);
12463  }
12464  /**
12465   * @param {PointerEvent} pointerEvent Pointer
12466   * event.
12467   * @private
12468   */
12469  handlePointerUp_(t) {
12470    this.updateActivePointers_(t);
12471    const i = new ui(
12472      dt.POINTERUP,
12473      this.map_,
12474      t,
12475      void 0,
12476      void 0,
12477      this.activePointers_
12478    );
12479    this.dispatchEvent(i), this.emulateClicks_ && !i.defaultPrevented && !this.dragging_ && this.isMouseActionButton_(t) && this.emulateClick_(this.down_), this.activePointers_.length === 0 && (this.dragListenerKeys_.forEach(Mt), this.dragListenerKeys_.length = 0, this.dragging_ = !1, this.down_ = null);
12480  }
12481  /**
12482   * @param {PointerEvent} pointerEvent Pointer
12483   * event.
12484   * @return {boolean} If the left mouse button was pressed.
12485   * @private
12486   */
12487  isMouseActionButton_(t) {
12488    return t.button === 0;
12489  }
12490  /**
12491   * @param {PointerEvent} pointerEvent Pointer
12492   * event.
12493   * @private
12494   */
12495  handlePointerDown_(t) {
12496    this.emulateClicks_ = this.activePointers_.length === 0, this.updateActivePointers_(t);
12497    const i = new ui(
12498      dt.POINTERDOWN,
12499      this.map_,
12500      t,
12501      void 0,
12502      void 0,
12503      this.activePointers_
12504    );
12505    if (this.dispatchEvent(i), this.down_ = new PointerEvent(t.type, t), Object.defineProperty(this.down_, "target", {
12506      writable: !1,
12507      value: t.target
12508    }), this.dragListenerKeys_.length === 0) {
12509      const s = this.map_.getOwnerDocument();
12510      this.dragListenerKeys_.push(
12511        lt(
12512          s,
12513          dt.POINTERMOVE,
12514          this.handlePointerMove_,
12515          this
12516        ),
12517        lt(s, dt.POINTERUP, this.handlePointerUp_, this),
12518        /* Note that the listener for `pointercancel is set up on
12519         * `pointerEventHandler_` and not `documentPointerEventHandler_` like
12520         * the `pointerup` and `pointermove` listeners.
12521         *
12522         * The reason for this is the following: `TouchSource.vacuumTouches_()`
12523         * issues `pointercancel` events, when there was no `touchend` for a
12524         * `touchstart`. Now, let's say a first `touchstart` is registered on
12525         * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.
12526         * But `documentPointerEventHandler_` doesn't know about the first
12527         * `touchstart`. If there is no `touchend` for the `touchstart`, we can
12528         * only receive a `touchcancel` from `pointerEventHandler_`, because it is
12529         * only registered there.
12530         */
12531        lt(
12532          this.element_,
12533          dt.POINTERCANCEL,
12534          this.handlePointerUp_,
12535          this
12536        )
12537      ), this.element_.getRootNode && this.element_.getRootNode() !== s && this.dragListenerKeys_.push(
12538        lt(
12539          this.element_.getRootNode(),
12540          dt.POINTERUP,
12541          this.handlePointerUp_,
12542          this
12543        )
12544      );
12545    }
12546  }
12547  /**
12548   * @param {PointerEvent} pointerEvent Pointer
12549   * event.
12550   * @private
12551   */
12552  handlePointerMove_(t) {
12553    if (this.isMoving_(t)) {
12554      this.updateActivePointers_(t), this.dragging_ = !0;
12555      const i = new ui(
12556        dt.POINTERDRAG,
12557        this.map_,
12558        t,
12559        this.dragging_,
12560        void 0,
12561        this.activePointers_
12562      );
12563      this.dispatchEvent(i);
12564    }
12565  }
12566  /**
12567   * Wrap and relay a pointermove event.
12568   * @param {PointerEvent} pointerEvent Pointer
12569   * event.
12570   * @private
12571   */
12572  relayMoveEvent_(t) {
12573    this.originalPointerMoveEvent_ = t;
12574    const i = !!(this.down_ && this.isMoving_(t));
12575    this.dispatchEvent(
12576      new ui(
12577        dt.POINTERMOVE,
12578        this.map_,
12579        t,
12580        i
12581      )
12582    );
12583  }
12584  /**
12585   * Flexible handling of a `touch-action: none` css equivalent: because calling
12586   * `preventDefault()` on a `pointermove` event does not stop n
12586ative page scrolling
12587   * and zooming, we also listen for `touchmove` and call `preventDefault()` on it
12588   * when an interaction (currently `DragPan` handles the event.
12589   * @param {TouchEvent} event Event.
12590   * @private
12591   */
12592  handleTouchMove_(t) {
12593    const i = this.originalPointerMoveEvent_;
12594    (!i || i.defaultPrevented) && (typeof t.cancelable != "boolean" || t.cancelable === !0) && t.preventDefault();
12595  }
12596  /**
12597   * @param {PointerEvent} pointerEvent Pointer
12598   * event.
12599   * @return {boolean} Is moving.
12600   * @private
12601   */
12602  isMoving_(t) {
12603    return this.dragging_ || Math.abs(t.clientX - this.down_.clientX) > this.moveTolerance_ || Math.abs(t.clientY - this.down_.clientY) > this.moveTolerance_;
12604  }
12605  /**
12606   * Clean up.
12607   */
12608  disposeInternal() {
12609    this.relayedListenerKey_ && (Mt(this.relayedListenerKey_), this.relayedListenerKey_ = null), this.element_.removeEventListener(
12610      et.TOUCHMOVE,
12611      this.boundHandleTouchMove_
12612    ), this.pointerdownListenerKey_ && (Mt(this.pointerdownListenerKey_), this.pointerdownListenerKey_ = null), this.dragListenerKeys_.forEach(Mt), this.dragListenerKeys_.length = 0, this.element_ = null, super.disposeInternal();
12613  }
12614}
12615const SM = wM, Oi = {
12616  /**
12617   * Triggered after a map frame is rendered.
12618   * @event module:ol/MapEvent~MapEvent#postrender
12619   * @api
12620   */
12621  POSTRENDER: "postrender",
12622  /**
12623   * Triggered when the map starts moving.
12624   * @event module:ol/MapEvent~MapEvent#movestart
12625   * @api
12626   */
12627  MOVESTART: "movestart",
12628  /**
12629   * Triggered after the map is moved.
12630   * @event module:ol/MapEvent~MapEvent#moveend
12631   * @api
12632   */
12633  MOVEEND: "moveend",
12634  /**
12635   * Triggered when loading of additional map data (tiles, images, features) starts.
12636   * @event module:ol/MapEvent~MapEvent#loadstart
12637   * @api
12638   */
12639  LOADSTART: "loadstart",
12640  /**
12641   * Triggered when loading of additional map data has completed.
12642   * @event module:ol/MapEvent~MapEvent#loadend
12643   * @api
12644   */
12645  LOADEND: "loadend"
12646}, Qt = {
12647  LAYERGROUP: "layergroup",
12648  SIZE: "size",
12649  TARGET: "target",
12650  VIEW: "view"
12651}, zo = 1 / 0;
12652class TM {
12653  /**
12654   * @param {function(T): number} priorityFunction Priority function.
12655   * @param {function(T): string} keyFunction Key function.
12656   */
12657  constructor(t, i) {
12658    this.priorityFunction_ = t, this.keyFunction_ = i, this.elements_ = [], this.priorities_ = [], this.queuedElements_ = {};
12659  }
12660  /**
12661   * FIXME empty description for jsdoc
12662   */
12663  clear() {
12664    this.elements_.length = 0, this.priorities_.length = 0, Tr(this.queuedElements_);
12665  }
12666  /**
12667   * Remove and return the highest-priority element. O(log N).
12668   * @return {T} Element.
12669   */
12670  dequeue() {
12671    const t = this.elements_, i = this.priorities_, s = t[0];
12672    t.length == 1 ? (t.length = 0, i.length = 0) : (t[0] = t.pop(), i[0] = i.pop(), this.siftUp_(0));
12673    const n = this.keyFunction_(s);
12674    return delete this.queuedElements_[n], s;
12675  }
12676  /**
12677   * Enqueue an element. O(log N).
12678   * @param {T} element Element.
12679   * @return {boolean} The element was added to the queue.
12680   */
12681  enqueue(t) {
12682    at(!(this.keyFunction_(t) in this.queuedElements_), 31);
12683    const i = this.priorityFunction_(t);
12684    return i != zo ? (this.elements_.push(t), this.priorities_.push(i), this.queuedElements_[this.keyFunction_(t)] = !0, this.siftDown_(0, this.elements_.length - 1), !0) : !1;
12685  }
12686  /**
12687   * @return {number} Count.
12688   */
12689  getCount() {
12690    return this.elements_.length;
12691  }
12692  /**
12693   * Gets the index of the left child of the node at the given index.
12694   * @param {number} index The index of the node to get the left child for.
12695   * @return {number} The index of the left child.
12696   * @private
12697   */
12698  getLeftChildIndex_(t) {
12699    return t * 2 + 1;
12700  }
12701  /**
12702   * Gets the index of the right child of the node at the given index.
12703   * @param {number} index The index of the node to get the right child for.
12704   * @return {number} The index of the right child.
12705   * @private
12706   */
12707  getRightChildIndex_(t) {
12708    return t * 2 + 2;
12709  }
12710  /**
12711   * Gets the index of the parent of the node at the given index.
12712   * @param {number} index The index of the node to get the parent for.
12713   * @return {number} The index of the parent.
12714   * @private
12715   */
12716  getParentIndex_(t) {
12717    return t - 1 >> 1;
12718  }
12719  /**
12720   * Make this a heap. O(N).
12721   * @private
12722   */
12723  heapify_() {
12724    let t;
12725    for (t = (this.elements_.length >> 1) - 1; t >= 0; t--)
12726      this.siftUp_(t);
12727  }
12728  /**
12729   * @return {boolean} Is empty.
12730   */
12731  isEmpty() {
12732    return this.elements_.length === 0;
12733  }
12734  /**
12735   * @param {string} key Key.
12736   * @return {boolean} Is key queued.
12737   */
12738  isKeyQueued(t) {
12739    return t in this.queuedElements_;
12740  }
12741  /**
12742   * @param {T} element Element.
12743   * @return {boolean} Is queued.
12744   */
12745  isQueued(t) {
12746    return this.isKeyQueued(this.keyFunction_(t));
12747  }
12748  /**
12749   * @param {number} index The index of the node to move down.
12750   * @private
12751   */
12752  siftUp_(t) {
12753    const i = this.elements_, s = this.priorities_, n = i.length, r = i[t], o = s[t], a = t;
12754    for (; t < n >> 1; ) {
12755      const l = this.getLeftChildIndex_(t), h = this.getRightChildIndex_(t), c = h < n && s[h] < s[l] ? h : l;
12756      i[t] = i[c], s[t] = s[c], t = c;
12757    }
12758    i[t] = r, s[t] = o, this.siftDown_(a, t);
12759  }
12760  /**
12761   * @param {number} startIndex The index of the root.
12762   * @param {number} index The index of the node to move up.
12763   * @private
12764   */
12765  siftDown_(t, i) {
12766    const s = this.elements_, n = this.priorities_, r = s[i], o = n[i];
12767    for (; i > t; ) {
12768      const a = this.getParentIndex_(i);
12769      if (n[a] > o)
12770        s[i] = s[a], n[i] = n[a], i = a;
12771      else
12772        break;
12773    }
12774    s[i] = r, n[i] = o;
12775  }
12776  /**
12777   * FIXME empty description for jsdoc
12778   */
12779  reprioritize() {
12780    const t = this.priorityFunction_, i = this.elements_, s = this.priorities_;
12781    let n = 0;
12782    const r = i.length;
12783    let o, a, l;
12784    for (a = 0; a < r; ++a)
12785      o = i[a], l = t(o), l == zo ? delete this.queuedElements_[this.keyFunction_(o)] : (s[n] = l, i[n++] = o);
12786    i.length = n, s.length = n, this.heapify_();
12787  }
12788}
12789const RM = TM, H = {
12790  IDLE: 0,
12791  LOADING: 1,
12792  LOADED: 2,
12793  /**
12794   * Indicates that tile loading failed
12795   * @type {number}
12796   */
12797  ERROR: 3,
12798  EMPTY: 4
12799};
12800class IM extends RM {
12801  /**
12802   * @param {PriorityFunction} tilePriorityFunction Tile priority function.
12803   * @param {function(): ?} tileChangeCallback Function called on each tile change event.
12804   */
12805  constructor(t, i) {
12806    super(
12807      /**
12808       * @param {Array} element Element.
12809       * @return {number} Priority.
12810       */
12811      function(s) {
12812        return t.apply(null, s);
12813      },
12814      /**
12815       * @param {Array} element Element.
12816       * @return {string} Key.
12817       */
12818      function(s) {
12819        return (
12820          /** @type {import("./Tile.js").default} */
12821          s[0].getKey()
12822        );
12823      }
12824    ), this.boundHandleTileChange_ = this.handleTileChange.bind(this), this.tileChangeCallback_ = i, this.tilesLoading_ = 0, this.tilesLoadingKeys_ = {};
12825  }
12826  /**
12827   * @param {Array} element Element.
12828   * @return {boolean} The element was added to the queue.
12829   */
12830  enqueue(t) {
12831    const i = super.enqueue(t);
12832    return i && t[0].addEventListener(et.CHANGE, this.boundHandleTileChange_), i;
12833  }
12834  /**
12835   * @return {number} Number of tiles loading.
12836   */
12837  getTilesLoading() {
12838    return this.tilesLoading_;
12839  }
12840  /**
12841   * @param {import("./events/Event.js").default} event Event.
12842   * @protected
12843   */
12844  handleTileChange(t) {
12845    const i = (
12846      /** @type {import("./Tile.js").default} */
12847      t.target
12848    ), s = i.getState();
12849    if (s === H.LOADED || s === H.ERROR || s === H.EMPTY) {
12850      s !== H.ERROR && i.removeEventListener(et.CHANGE, this.boundHandleTileChange_);
12851      const n = i.getKey();
12852      n in this.tilesLoadingKeys_ && (delete this.tilesLoadingKeys_[n], --this.tilesLoading_), this.tileChangeCallback_();
12853    }
12854  }
12855  /**
12856   * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.
12857   * @param {number} maxNewLoads Maximum number of new tiles to load.
12858   */
12859  loadMoreTiles(t, i) {
12860    let s = 0, n, r, o;
12861    for (; this.tilesLoading_ < t && s < i && this.getCount() > 0; )
12862      r = /** @type {import("./Tile.js").default} */
12863      this.dequeue()[0], o = r.getKey(), n = r.getState(), n === H.IDLE && !(o in this.tilesLoadingKeys_) && (this.tilesLoadingKeys_[o] = !0, ++this.tilesLoading_, ++s, r.load());
12864  }
12865}
12866const PM = IM;
12867function AM(e, t, i, s, n) {
12868  if (!e || !(i in e.wantedTiles) || !e.wantedTiles[i][t.getKey()])
12869    return zo;
12870  const r = e.viewState.center, o = s[0] - r[0], a = s[1] - r[1];
12871  return 65536 * Math.log(n) + Math.sqrt(o * o + a * a) / n;
12872}
12873class LM extends ni {
12874  /**
12875   * @param {Options} options Control options.
12876   */
12877  constructor(t) {
12878    super();
12879    const i = t.element;
12880    i && !t.target && !i.style.pointerEvents && (i.style.pointerEvents = "auto"), this.element = i || null, this.target_ = null, this.map_ = null, this.listenerKeys = [], t.render && (this.render = t.render), t.target && this.setTarget(t.target);
12881  }
12882  /**
12883   * Clean up.
12884   */
12885  disposeInternal() {
12886    Il(this.element), super.disposeInternal();
12887  }
12888  /**
12889   * Get the map associated with this control.
12890   * @return {import("../Map.js").default|null} Map.
12891   * @api
12892   */
12893  getMap() {
12894    return this.map_;
12895  }
12896  /**
12897   * Remove the control from its current map and attach it to the new map.
12898   * Pass `null` to just remove the control from the current map.
12899   * Subclasses may set up event handlers to get notified about changes to
12900   * the map here.
12901   * @param {import("../Map.js").default|null} map Map.
12902   * @api
12903   */
12904  setMap(t) {
12905    this.map_ && Il(this.element);
12906    for (let i = 0, s = this.listenerKeys.length; i < s; ++i)
12907      Mt(this.listenerKeys[i]);
12908    this.listenerKeys.length = 0, this.map_ = t, t && ((this.target_ ? this.target_ : t.getOverlayContainerStopEvent()).appendChild(this.element), this.render !== Mn && this.listenerKeys.push(
12909      lt(t, Oi.POSTRENDER, this.render, this)
12910    ), t.render());
12911  }
12912  /**
12913   * Renders the control.
12914   * @param {import("../MapEvent.js").default} mapEvent Map event.
12915   * @api
12916   */
12917  render(t) {
12918  }
12919  /**
12920   * This function is used to set a target element for the control. It has no
12921   * effect if it is called after the control has been added to the map (i.e.
12922   * after `setMap` is called on the control). If no `target` is set in the
12923   * options passed to the control constructor and if `setTarget` is not called
12924   * then the control is added to the map's overlay container.
12925   * @param {HTMLElement|string} target Target.
12926   * @api
12927   */
12928  setTarget(t) {
12929    this.target_ = typeof t == "string" ? document.getElementById(t) : t;
12930  }
12931}
12932const Bh = LM;
12933class OM extends Bh {
12934  /**
12935   * @param {Options} [options] Attribution options.
12936   */
12937  constructor(t) {
12938    t = t || {}, super({
12939      element: document.createElement("div"),
12940      render: t.render,
12941      target: t.target
12942    }), this.ulElement_ = document.createElement("ul"), this.collapsed_ = t.collapsed !== void 0 ? t.collapsed : !0, this.userCollapsed_ = this.collapsed_, this.overrideCollapsible_ = t.collapsible !== void 0, this.collapsible_ = t.collapsible !== void 0 ? t.collapsible : !0, this.collapsible_ || (this.collapsed_ = !1);
12943    const i = t.className !== void 0 ? t.className : "ol-attribution", s = t.tipLabel !== void 0 ? t.tipLabel : "Attributions", n = t.expandClassName !== void 0 ? t.expandClassName : i + "-expand", r = t.collapseLabel !== void 0 ? t.collapseLabel : "›", o = t.collapseClassName !== void 0 ? t.collapseClassName : i + "-collapse";
12944    typeof r == "string" ? (this.collapseLabel_ = document.createElement("span"), this.collapseLabel_.textContent = r, this.collapseLabel_.className = o) : this.collapseLabel_ = r;
12945    const a = t.label !== void 0 ? t.label : "i";
12946    typeof a == "string" ? (this.label_ = document.createElement("span"), this.label_.textContent = a, this.label_.className = n) : this.label_ = a;
12947    const l = this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;
12948    this.toggleButton_ = document.createElement("button"), this.toggleButton_.setAttribute("type", "button"), this.toggleButton_.setAttribute("aria-expanded", String(!this.collapsed_)), this.toggleButton_.title = s, this.toggleButton_.appendChild(l), this.toggleButton_.addEventListener(
12949      et.CLICK,
12950      this.handleClick_.bind(this),
12951      !1
12952    );
12953    const h = i + " " + ma + " " + jh + (this.collapsed_ && this.collapsible_ ? " " + Pu : "") + (this.collapsible_ ? "" : " ol-uncollapsible"), c = this.element;
12954    c.className = h, c.appendChild(this.toggleButton_), c.appendChild(this.ulElement_), this.renderedAttributions_ = [], this.renderedVisible_ = !0;
12955  }
12956  /**
12957   * Collect a list of visible attributions and set the collapsible state.
12958   * @param {import("../Map.js").FrameState} frameState Frame state.
12959   * @return {Array<string>} Attributions.
12960   * @private
12961   */
12962  collectSourceAttributions_(t) {
12963    const i = Array.from(
12964      new Set(
12965        this.getMap().getAllLayers().flatMap((n) => n.getAttributions(t))
12966      )
12967    ), s = !this.getMap().getAllLayers().some(
12968      (n) => n.getSource() && n.getSource().getAttributionsCollapsible() === !1
12969    );
12970    return this.overrideCollapsible_ || this.setCollapsible(s), i;
12971  }
12972  /**
12973   * @private
12974   * @param {?import("../Map.js").FrameState} frameState Frame state.
12975   */
12976  updateElement_(t) {
12977    if (!t) {
12978      this.renderedVisible_ && (this.element.style.display = "none", this.renderedVisible_ = !1);
12979      return;
12980    }
12981    const i = this.collectSourceAttributions_(t), s = i.length > 0;
12982    if (this.renderedVisible_ != s && (this.element.style.display = s ? "" : "none", this.renderedVisible_ = s), !wi(i, this.renderedAttributions_)) {
12983      gM(this.ulElement_);
12984      for (let n = 0, r = i.length; n < r; ++n) {
12985        const o = document.createElement("li");
12986        o.innerHTML = i[n], this.ulElement_.appendChild(o);
12987      }
12988      this.renderedAttributions_ = i;
12989    }
12990  }
12991  /**
12992   * @param {MouseEvent} event The event to handle
12993   * @private
12994   */
12995  handleClick_(t) {
12996    t.preventDefault(), this.handleToggle_(), this.userCollapsed_ = this.collapsed_;
12997  }
12998  /**
12999   * @private
13000   */
13001  handleToggle_() {
13002    this.element.classList.toggle(Pu), this.collapsed_ ? Lu(this.collapseLabel_, this.label_) : Lu(this.label_, this.collapseLabel_), this.collapsed_ = !this.collapsed_, this.toggleButton_.setAttribute("aria-expanded", String(!this.collapsed_));
13003  }
13004  /**
13005   * Return `true` if the attribution is collapsible, `false` otherwise.
13006   * @return {boolean} True if the widget is collapsible.
13007   * @api
13008   */
13009  getCollapsible() {
13010    return this.collapsible_;
13011  }
13012  /**
13013   * Set whether the attribution should be collapsible.
13014   * @param {boolean} collapsible True if the widget is collapsible.
13015   * @api
13016   */
13017  setCollapsible(t) {
13018    this.collapsible_ !== t && (this.collapsible_ = t, this.element.classList.toggle("ol-uncollapsible"), this.userCollapsed_ && this.handleToggle_());
13019  }
13020  /**
13021   * Collapse or expand the attribution according to the passed parameter. Will
13022   * not do anything if the attribution isn't collapsible or if the current
13023   * collapsed state is already the one requested.
13024   * @param {boolean} collapsed True if the widget is collapsed.
13025   * @api
13026   */
13027  setCollapsed(t) {
13028    this.userCollapsed_ = t, !(!this.collapsible_ || this.collapsed_ === t) && this.handleToggle_();
13029  }
13030  /**
13031   * Return `true` when the attribution is currently collapsed or `false`
13032   * otherwise.
13033   * @return {boolean} True if the widget is collapsed.
13034   * @api
13035   */
13036  getCollapsed() {
13037    return this.collapsed_;
13038  }
13039  /**
13040   * Update the attribution element.
13041   * @param {import("../MapEvent.js").default} mapEvent Map event.
13042   * @override
13043   */
13044  render(t) {
13045    this.updateElement_(t.frameState);
13046  }
13047}
13048const FM = OM;
13049class kM extends Bh {
13050  /**
13051   * @param {Options} [options] Rotate options.
13052   */
13053  constructor(t) {
13054    t = t || {}, super({
13055      element: document.createElement("div"),
13056      render: t.render,
13057      target: t.target
13058    });
13059    const i = t.className !== void 0 ? t.className : "ol-rotate", s = t.label !== void 0 ? t.label : "⇧", n = t.compassClassName !== void 0 ? t.compassClassName : "ol-compass";
13060    this.label_ = null, typeof s == "string" ? (this.label_ = document.createElement("span"), this.label_.className = n, this.label_.textContent = s) : (this.label_ = s, this.label_.classList.add(n));
13061    const r = t.tipLabel ? t.tipLabel : "Reset rotation", o = document.createElement("button");
13062    o.className = i + "-reset", o.setAttribute("type", "button"), o.title = r, o.appendChild(this.label_), o.addEventListener(
13063      et.CLICK,
13064      this.handleClick_.bind(this),
13065      !1
13066    );
13067    const a = i + " " + ma + " " + jh, l = this.element;
13068    l.className = a, l.appendChild(o), this.callResetNorth_ = t.resetNorth ? t.resetNorth : void 0, this.duration_ = t.duration !== void 0 ? t.duration : 250, this.autoHide_ = t.autoHide !== void 0 ? t.autoHide : !0, this.rotation_ = void 0, this.autoHide_ && this.element.classList.add(Zr);
13069  }
13070  /**
13071   * @param {MouseEvent} event The event to handle
13072   * @private
13073   */
13074  handleClick_(t) {
13075    t.preventDefault(), this.callResetNorth_ !== void 0 ? this.callResetNorth_() : this.resetNorth_();
13076  }
13077  /**
13078   * @private
13079   */
13080  resetNorth_() {
13081    const i = this.getMap().getView();
13082    if (!i)
13083      return;
13084    const s = i.getRotation();
13085    s !== void 0 && (this.duration_ > 0 && s % (2 * Math.PI) !== 0 ? i.animate({
13086      rotation: 0,
13087      duration: this.duration_,
13088      easing: Pn
13089    }) : i.setRotation(0));
13090  }
13091  /**
13092   * Update the rotate control element.
13093   * @param {import("../MapEvent.js").default} mapEvent Map event.
13094   * @override
13095   */
13096  render(t) {
13097    const i = t.frameState;
13098    if (!i)
13099      return;
13100    const s = i.viewState.rotation;
13101    if (s != this.rotation_) {
13102      const n = "rotate(" + s + "rad)";
13103      if (this.autoHide_) {
13104        const r = this.element.classList.contains(Zr);
13105        !r && s === 0 ? this.element.classList.add(Zr) : r && s !== 0 && this.element.classList.remove(Zr);
13106      }
13107      this.label_.style.transform = n;
13108    }
13109    this.rotation_ = s;
13110  }
13111}
13112const DM = kM;
13113class NM extends Bh {
13114  /**
13115   * @param {Options} [options] Zoom options.
13116   */
13117  constructor(t) {
13118    t = t || {}, super({
13119      element: document.createElement("div"),
13120      target: t.target
13121    });
13122    const i = t.className !== void 0 ? t.className : "ol-zoom", s = t.delta !== void 0 ? t.delta : 1, n = t.zoomInClassName !== void 0 ? t.zoomInClassName : i + "-in", r = t.zoomOutClassName !== void 0 ? t.zoomOutClassName : i + "-out", o = t.zoomInLabel !== void 0 ? t.zoomInLabel : "+", a = t.zoomOutLabel !== void 0 ? t.zoomOutLabel : "–", l = t.zoomInTipLabel !== void 0 ? t.zoomInTipLabel : "Zoom in", h = t.zoomOutTipLabel !== void 0 ? t.zoomOutTipLabel : "Zoom out", c = document.createElement("button");
13123    c.className = n, c.setAttribute("type", "button"), c.title = l, c.appendChild(
13124      typeof o == "string" ? document.createTextNode(o) : o
13125    ), c.addEventListener(
13126      et.CLICK,
13127      this.handleClick_.bind(this, s),
13128      !1
13129    );
13130    const u = document.createElement("button");
13131    u.className = r, u.setAttribute("type", "button"), u.title = h, u.appendChild(
13132      typeof a == "string" ? document.createTextNode(a) : a
13133    ), u.addEventListener(
13134      et.CLICK,
13135      this.handleClick_.bind(this, -s),
13136      !1
13137    );
13138    const d = i + " " + ma + " " + jh, f = this.element;
13139    f.className = d, f.appendChild(c), f.appendChild(u), this.duration_ = t.duration !== void 0 ? t.duration : 250;
13140  }
13141  /**
13142   * @param {number} delta Zoom delta.
13143   * @param {MouseEvent} event The event to handle
13144   * @private
13145   */
13146  handleClick_(t, i) {
13147    i.preventDefault(), this.zoomByDelta_(t);
13148  }
13149  /**
13150   * @param {number} delta Zoom delta.
13151   * @private
13152   */
13153  zoomByDelta_(t) {
13154    const s = this.getMap().getView();
13155    if (!s)
13156      return;
13157    const n = s.getZoom();
13158    if (n !== void 0) {
13159      const r = s.getConstrainedZoom(n + t);
13160      this.duration_ > 0 ? (s.getAnimating() && s.cancelAnimations(), s.animate({
13161        zoom: r,
13162        duration: this.duration_,
13163        easing: Pn
13164      })) : s.setZoom(r);
13165    }
13166  }
13167}
13168const GM = NM;
13169function zM(e) {
13170  e = e || {};
13171  const t = new Pe();
13172  return (e.zoom !== void 0 ? e.zoom : !0) && t.push(new GM(e.zoomOptions)), (e.rotate !== void 0 ? e.rotate : !0) && t.push(new DM(e.rotateOptions)), (e.attribution !== void 0 ? e.attribution : !0) && t.push(new FM(e.attributionOptions)), t;
13173}
13174const Ol = {
13175  ACTIVE: "active"
13176};
13177class jM extends ni {
13178  /**
13179   * @param {InteractionOptions} [options] Options.
13180   */
13181  constructor(t) {
13182    super(), this.on, this.once, this.un, t && t.handleEvent && (this.handleEvent = t.handleEvent), this.map_ = null, this.setActive(!0);
13183  }
13184  /**
13185   * Return whether the interaction is currently active.
13186   * @return {boolean} `true` if the interaction is active, `false` otherwise.
13187   * @observable
13188   * @api
13189   */
13190  getActive() {
13191    return (
13192      /** @type {boolean} */
13193      this.get(Ol.ACTIVE)
13194    );
13195  }
13196  /**
13197   * Get the map associated with this interaction.
13198   * @return {import("../Map.js").default|null} Map.
13199   * @api
13200   */
13201  getMap() {
13202    return this.map_;
13203  }
13204  /**
13205   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.
13206   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13207   * @return {boolean} `false` to stop event propagation.
13208   * @api
13209   */
13210  handleEvent(t) {
13211    return !0;
13212  }
13213  /**
13214   * Activate or deactivate the interaction.
13215   * @param {boolean} active Active.
13216   * @observable
13217   * @api
13218   */
13219  setActive(t) {
13220    this.set(Ol.ACTIVE, t);
13221  }
13222  /**
13223   * Remove the interaction from its current map and attach it to the new map.
13224   * Subclasses may set up event handlers to get notified about changes to
13225   * the map here.
13226   * @param {import("../Map.js").default|null} map Map.
13227   */
13228  setMap(t) {
13229    this.map_ = t;
13230  }
13231}
13232function WM(e, t, i) {
13233  const s = e.getCenterInternal();
13234  if (s) {
13235    const n = [s[0] + t[0], s[1] + t[1]];
13236    e.animateInternal({
13237      duration: i !== void 0 ? i : 250,
13238      easing: kE,
13239      center: e.getConstrainedCenter(n)
13240    });
13241  }
13242}
13243function Uh(e, t, i, s) {
13244  const n = e.getZoom();
13245  if (n === void 0)
13246    return;
13247  const r = e.getConstrainedZoom(n + t), o = e.getResolutionForZoom(r);
13248  e.getAnimating() && e.cancelAnimations(), e.animate({
13249    resolution: o,
13250    anchor: i,
13251    duration: s !== void 0 ? s : 250,
13252    easing: Pn
13253  });
13254}
13255const Or = jM;
13256class BM extends Or {
13257  /**
13258   * @param {Options} [options] Options.
13259   */
13260  constructor(t) {
13261    super(), t = t || {}, this.delta_ = t.delta ? t.delta : 1, this.duration_ = t.duration !== void 0 ? t.duration : 250;
13262  }
13263  /**
13264   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a
13265   * doubleclick) and eventually zooms the map.
13266   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13267   * @return {boolean} `false` to stop event propagation.
13268   */
13269  handleEvent(t) {
13270    let i = !1;
13271    if (t.type == dt.DBLCLICK) {
13272      const s = (
13273        /** @type {MouseEvent} */
13274        t.originalEvent
13275      ), n = t.map, r = t.coordinate, o = s.shiftKey ? -this.delta_ : this.delta_, a = n.getView();
13276      Uh(a, o, r, this.duration_), s.preventDefault(), i = !0;
13277    }
13278    return !i;
13279  }
13280}
13281const _g = BM;
13282class UM extends Or {
13283  /**
13284   * @param {Options} [options] Options.
13285   */
13286  constructor(t) {
13287    t = t || {}, super(
13288      /** @type {import("./Interaction.js").InteractionOptions} */
13289      t
13290    ), t.handleDownEvent && (this.handleDownEvent = t.handleDownEvent), t.handleDragEvent && (this.handleDragEvent = t.handleDragEvent), t.handleMoveEvent && (this.handleMoveEvent = t.handleMoveEvent), t.handleUpEvent && (this.handleUpEvent = t.handleUpEvent), t.stopDown && (this.stopDown = t.stopDown), this.handlingDownUpSequence = !1, this.targetPointers = [];
13291  }
13292  /**
13293   * Returns the current number of pointers involved in the interaction,
13294   * e.g. `2` when two fingers are used.
13295   * @return {number} The number of pointers.
13296   * @api
13297   */
13298  getPointerCount() {
13299    return this.targetPointers.length;
13300  }
13301  /**
13302   * Handle pointer down events.
13303   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13304   * @return {boolean} If the event was consumed.
13305   * @protected
13306   */
13307  handleDownEvent(t) {
13308    return !1;
13309  }
13310  /**
13311   * Handle pointer drag events.
13312   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13313   * @protected
13314   */
13315  handleDragEvent(t) {
13316  }
13317  /**
13318   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into
13319   * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
13320   * detected.
13321   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13322   * @return {boolean} `false` to stop event propagation.
13323   * @api
13324   */
13325  handleEvent(t) {
13326    if (!t.originalEvent)
13327      return !0;
13328    let i = !1;
13329    if (this.updateTrackedPointers_(t), this.handlingDownUpSequence) {
13330      if (t.type == dt.POINTERDRAG)
13331        this.handleDragEvent(t), t.originalEvent.preventDefault();
13332      else if (t.type == dt.POINTERUP) {
13333        const s = this.handleUpEvent(t);
13334        this.handlingDownUpSequence = s && this.targetPointers.length > 0;
13335      }
13336    } else if (t.type == dt.POINTERDOWN) {
13337      const s = this.handleDownEvent(t);
13338      this.handlingDownUpSequence = s, i = this.stopDown(s);
13339    } else
13340      t.type == dt.POINTERMOVE && this.handleMoveEvent(t);
13341    return !i;
13342  }
13343  /**
13344   * Handle pointer move events.
13345   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13346   * @protected
13347   */
13348  handleMoveEvent(t) {
13349  }
13350  /**
13351   * Handle pointer up events.
13352   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13353   * @return {boolean} If the event was consumed.
13354   * @protected
13355   */
13356  handleUpEvent(t) {
13357    return !1;
13358  }
13359  /**
13360   * This function is used to determine if "down" events should be propagated
13361   * to other interactions or should be stopped.
13362   * @param {boolean} handled Was the event handled by the interaction?
13363   * @return {boolean} Should the `down` event be stopped?
13364   */
13365  stopDown(t) {
13366    return t;
13367  }
13368  /**
13369   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13370   * @private
13371   */
13372  updateTrackedPointers_(t) {
13373    t.activePointers && (this.targetPointers = t.activePointers);
13374  }
13375}
13376function Xh(e) {
13377  const t = e.length;
13378  let i = 0, s = 0;
13379  for (let n = 0; n < t; n++)
13380    i += e[n].clientX, s += e[n].clientY;
13381  return { clientX: i / t, clientY: s / t };
13382}
13383const is = UM;
13384function Fl(e) {
13385  const t = arguments;
13386  return function(i) {
13387    let s = !0;
13388    for (let n = 0, r = t.length; n < r && (s = s && t[n](i), !!s); ++n)
13389      ;
13390    return s;
13391  };
13392}
13393const XM = function(e) {
13394  const t = (
13395    /** @type {KeyboardEvent|MouseEvent|TouchEvent} */
13396    e.originalEvent
13397  );
13398  return t.altKey && !(t.metaKey || t.ctrlKey) && !t.shiftKey;
13399}, $M = function(e) {
13400  const t = (
13401    /** @type {KeyboardEvent|MouseEvent|TouchEvent} */
13402    e.originalEvent
13403  );
13404  return t.altKey && !(t.metaKey || t.ctrlKey) && t.shiftKey;
13405}, YM = function(e) {
13406  const t = e.map.getTargetElement(), i = e.map.getOwnerDocument().activeElement;
13407  return t.contains(i);
13408}, mg = function(e) {
13409  return e.map.getTargetElement().hasAttribute("tabindex") ? YM(e) : !0;
13410}, jo = Ss, pg = function(e) {
13411  const t = (
13412    /** @type {MouseEvent} */
13413    e.originalEvent
13414  );
13415  return t.button == 0 && !(gE && _E && t.ctrlKey);
13416}, KM = As, qM = function(e) {
13417  return e.type == dt.SINGLECLICK;
13418}, $h = function(e) {
13419  const t = (
13420    /** @type {KeyboardEvent|MouseEvent|TouchEvent} */
13421    e.originalEvent
13422  );
13423  return !t.altKey && !(t.metaKey || t.ctrlKey) && !t.shiftKey;
13424}, yg = function(e) {
13425  const t = (
13426    /** @type {KeyboardEvent|MouseEvent|TouchEvent} */
13427    e.originalEvent
13428  );
13429  return !t.altKey && !(t.metaKey || t.ctrlKey) && t.shiftKey;
13430}, xg = function(e) {
13431  const t = (
13432    /** @type {KeyboardEvent|MouseEvent|TouchEvent} */
13433    e.originalEvent
13434  ), i = (
13435    /** @type {Element} */
13436    t.target.tagName
13437  );
13438  return i !== "INPUT" && i !== "SELECT" && i !== "TEXTAREA" && // `isContentEditable` is only available on `HTMLElement`, but it may al
13438so be a
13439  // different type like `SVGElement`.
13440  // @ts-ignore
13441  !t.target.isContentEditable;
13442}, za = function(e) {
13443  const t = (
13444    /** @type {import("../MapBrowserEvent").default} */
13445    e.originalEvent
13446  );
13447  return at(t !== void 0, 56), t.pointerType == "mouse";
13448}, vg = function(e) {
13449  const t = (
13450    /** @type {import("../MapBrowserEvent").default} */
13451    e.originalEvent
13452  );
13453  return at(t !== void 0, 56), t.isPrimary && t.button === 0;
13454};
13455class VM extends is {
13456  /**
13457   * @param {Options} [options] Options.
13458   */
13459  constructor(t) {
13460    super({
13461      stopDown: As
13462    }), t = t || {}, this.kinetic_ = t.kinetic, this.lastCentroid = null, this.lastPointersCount_, this.panning_ = !1;
13463    const i = t.condition ? t.condition : Fl($h, vg);
13464    this.condition_ = t.onFocusOnly ? Fl(mg, i) : i, this.noKinetic_ = !1;
13465  }
13466  /**
13467   * Handle pointer drag events.
13468   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13469   */
13470  handleDragEvent(t) {
13471    const i = t.map;
13472    this.panning_ || (this.panning_ = !0, i.getView().beginInteraction());
13473    const s = this.targetPointers, n = i.getEventPixel(Xh(s));
13474    if (s.length == this.lastPointersCount_) {
13475      if (this.kinetic_ && this.kinetic_.update(n[0], n[1]), this.lastCentroid) {
13476        const r = [
13477          this.lastCentroid[0] - n[0],
13478          n[1] - this.lastCentroid[1]
13479        ], a = t.map.getView();
13480        l1(r, a.getResolution()), Jl(r, a.getRotation()), a.adjustCenterInternal(r);
13481      }
13482    } else
13483      this.kinetic_ && this.kinetic_.begin();
13484    this.lastCentroid = n, this.lastPointersCount_ = s.length, t.originalEvent.preventDefault();
13485  }
13486  /**
13487   * Handle pointer up events.
13488   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13489   * @return {boolean} If the event was consumed.
13490   */
13491  handleUpEvent(t) {
13492    const i = t.map, s = i.getView();
13493    if (this.targetPointers.length === 0) {
13494      if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
13495        const n = this.kinetic_.getDistance(), r = this.kinetic_.getAngle(), o = s.getCenterInternal(), a = i.getPixelFromCoordinateInternal(o), l = i.getCoordinateFromPixelInternal([
13496          a[0] - n * Math.cos(r),
13497          a[1] - n * Math.sin(r)
13498        ]);
13499        s.animateInternal({
13500          center: s.getConstrainedCenter(l),
13501          duration: 500,
13502          easing: Pn
13503        });
13504      }
13505      return this.panning_ && (this.panning_ = !1, s.endInteraction()), !1;
13506    }
13507    return this.kinetic_ && this.kinetic_.begin(), this.lastCentroid = null, !0;
13508  }
13509  /**
13510   * Handle pointer down events.
13511   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13512   * @return {boolean} If the event was consumed.
13513   */
13514  handleDownEvent(t) {
13515    if (this.targetPointers.length > 0 && this.condition_(t)) {
13516      const s = t.map.getView();
13517      return this.lastCentroid = null, s.getAnimating() && s.cancelAnimations(), this.kinetic_ && this.kinetic_.begin(), this.noKinetic_ = this.targetPointers.length > 1, !0;
13518    }
13519    return !1;
13520  }
13521}
13522const HM = VM;
13523class ZM extends is {
13524  /**
13525   * @param {Options} [options] Options.
13526   */
13527  constructor(t) {
13528    t = t || {}, super({
13529      stopDown: As
13530    }), this.condition_ = t.condition ? t.condition : $M, this.lastAngle_ = void 0, this.duration_ = t.duration !== void 0 ? t.duration : 250;
13531  }
13532  /**
13533   * Handle pointer drag events.
13534   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13535   */
13536  handleDragEvent(t) {
13537    if (!za(t))
13538      return;
13539    const i = t.map, s = i.getView();
13540    if (s.getConstraints().rotation === Ih)
13541      return;
13542    const n = i.getSize(), r = t.pixel, o = Math.atan2(n[1] / 2 - r[1], r[0] - n[0] / 2);
13543    if (this.lastAngle_ !== void 0) {
13544      const a = o - this.lastAngle_;
13545      s.adjustRotationInternal(-a);
13546    }
13547    this.lastAngle_ = o;
13548  }
13549  /**
13550   * Handle pointer up events.
13551   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13552   * @return {boolean} If the event was consumed.
13553   */
13554  handleUpEvent(t) {
13555    return za(t) ? (t.map.getView().endInteraction(this.duration_), !1) : !0;
13556  }
13557  /**
13558   * Handle pointer down events.
13559   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13560   * @return {boolean} If the event was consumed.
13561   */
13562  handleDownEvent(t) {
13563    return za(t) && pg(t) && this.condition_(t) ? (t.map.getView().beginInteraction(), this.lastAngle_ = void 0, !0) : !1;
13564  }
13565}
13566const JM = ZM;
13567class QM extends Ch {
13568  /**
13569   * @param {string} className CSS class name.
13570   */
13571  constructor(t) {
13572    super(), this.geometry_ = null, this.element_ = document.createElement("div"), this.element_.style.position = "absolute", this.element_.style.pointerEvents = "auto", this.element_.className = "ol-box " + t, this.map_ = null, this.startPixel_ = null, this.endPixel_ = null;
13573  }
13574  /**
13575   * Clean up.
13576   */
13577  disposeInternal() {
13578    this.setMap(null);
13579  }
13580  /**
13581   * @private
13582   */
13583  render_() {
13584    const t = this.startPixel_, i = this.endPixel_, s = "px", n = this.element_.style;
13585    n.left = Math.min(t[0], i[0]) + s, n.top = Math.min(t[1], i[1]) + s, n.width = Math.abs(i[0] - t[0]) + s, n.height = Math.abs(i[1] - t[1]) + s;
13586  }
13587  /**
13588   * @param {import("../Map.js").default|null} map Map.
13589   */
13590  setMap(t) {
13591    if (this.map_) {
13592      this.map_.getOverlayContainer().removeChild(this.element_);
13593      const i = this.element_.style;
13594      i.left = "inherit", i.top = "inherit", i.width = "inherit", i.height = "
13594inherit";
13595    }
13596    this.map_ = t, this.map_ && this.map_.getOverlayContainer().appendChild(this.element_);
13597  }
13598  /**
13599   * @param {import("../pixel.js").Pixel} startPixel Start pixel.
13600   * @param {import("../pixel.js").Pixel} endPixel End pixel.
13601   */
13602  setPixels(t, i) {
13603    this.startPixel_ = t, this.endPixel_ = i, this.createOrUpdateGeometry(), this.render_();
13604  }
13605  /**
13606   * Creates or updates the cached geometry.
13607   */
13608  createOrUpdateGeometry() {
13609    const t = this.startPixel_, i = this.endPixel_, n = [
13610      t,
13611      [t[0], i[1]],
13612      i,
13613      [i[0], t[1]]
13614    ].map(
13615      this.map_.getCoordinateFromPixelInternal,
13616      this.map_
13617    );
13618    n[4] = n[0].slice(), this.geometry_ ? this.geometry_.setCoordinates([n]) : this.geometry_ = new bn([n]);
13619  }
13620  /**
13621   * @return {import("../geom/Polygon.js").default} Geometry.
13622   */
13623  getGeometry() {
13624    return this.geometry_;
13625  }
13626}
13627const tC = QM, Jr = {
13628  /**
13629   * Triggered upon drag box start.
13630   * @event DragBoxEvent#boxstart
13631   * @api
13632   */
13633  BOXSTART: "boxstart",
13634  /**
13635   * Triggered on drag when box is active.
13636   * @event DragBoxEvent#boxdrag
13637   * @api
13638   */
13639  BOXDRAG: "boxdrag",
13640  /**
13641   * Triggered upon drag box end.
13642   * @event DragBoxEvent#boxend
13643   * @api
13644   */
13645  BOXEND: "boxend",
13646  /**
13647   * Triggered upon drag box canceled.
13648   * @event DragBoxEvent#boxcancel
13649   * @api
13650   */
13651  BOXCANCEL: "boxcancel"
13652};
13653class ja extends Ae {
13654  /**
13655   * @param {string} type The event type.
13656   * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
13657   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
13658   */
13659  constructor(t, i, s) {
13660    super(t), this.coordinate = i, this.mapBrowserEvent = s;
13661  }
13662}
13663class eC extends is {
13664  /**
13665   * @param {Options} [options] Options.
13666   */
13667  constructor(t) {
13668    super(), this.on, this.once, this.un, t = t || {}, this.box_ = new tC(t.className || "ol-dragbox"), this.minArea_ = t.minArea !== void 0 ? t.minArea : 64, t.onBoxEnd && (this.onBoxEnd = t.onBoxEnd), this.startPixel_ = null, this.condition_ = t.condition ? t.condition : pg, this.boxEndCondition_ = t.boxEndCondition ? t.boxEndCondition : this.defaultBoxEndCondition;
13669  }
13670  /**
13671   * The default condition for determining whether the boxend event
13672   * should fire.
13673   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
13674   *     leading to the box end.
13675   * @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
13676   * @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
13677   * @return {boolean} Whether or not the boxend condition should be fired.
13678   */
13679  defaultBoxEndCondition(t, i, s) {
13680    const n = s[0] - i[0], r = s[1] - i[1];
13681    return n * n + r * r >= this.minArea_;
13682  }
13683  /**
13684   * Returns geometry of last drawn box.
13685   * @return {import("../geom/Polygon.js").default} Geometry.
13686   * @api
13687   */
13688  getGeometry() {
13689    return this.box_.getGeometry();
13690  }
13691  /**
13692   * Handle pointer drag events.
13693   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13694   */
13695  handleDragEvent(t) {
13696    this.box_.setPixels(this.startPixel_, t.pixel), this.dispatchEvent(
13697      new ja(
13698        Jr.BOXDRAG,
13699        t.coordinate,
13700        t
13701      )
13702    );
13703  }
13704  /**
13705   * Handle pointer up events.
13706   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13707   * @return {boolean} If the event was consumed.
13708   */
13709  handleUpEvent(t) {
13710    this.box_.setMap(null);
13711    const i = this.boxEndCondition_(
13712      t,
13713      this.startPixel_,
13714      t.pixel
13715    );
13716    return i && this.onBoxEnd(t), this.dispatchEvent(
13717      new ja(
13718        i ? Jr.BOXEND : Jr.BOXCANCEL,
13719        t.coordinate,
13720        t
13721      )
13722    ), !1;
13723  }
13724  /**
13725   * Handle pointer down events.
13726   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
13727   * @return {boolean} If the event was consumed.
13728   */
13729  handleDownEvent(t) {
13730    return this.condition_(t) ? (this.startPixel_ = t.pixel, this.box_.setMap(t.map), this.box_.setPixels(this.startPixel_, this.startPixel_), this.dispatchEvent(
13731      new ja(
13732        Jr.BOXSTART,
13733        t.coordinate,
13734        t
13735      )
13736    ), !0) : !1;
13737  }
13738  /**
13739   * Function to execute just before `onboxend` is fired
13740   * @param {import("../MapBrowserEvent.js").default} event Event.
13741   */
13742  onBoxEnd(t) {
13743  }
13744}
13745const iC = eC;
13746class sC extends iC {
13747  /**
13748   * @param {Options} [options] Options.
13749   */
13750  constructor(t) {
13751    t = t || {};
13752    const i = t.condition ? t.condition : yg;
13753    super({
13754      condition: i,
13755      className: t.className || "ol-dragzoom",
13756      minArea: t.minArea
13757    }), this.duration_ = t.duration !== void 0 ? t.duration : 200, this.out_ = t.out !== void 0 ? t.out : !1;
13758  }
13759  /**
13760   * Function to execute just before `onboxend` is fired
13761   * @param {import("../MapBrowserEvent.js").default} event Event.
13762   */
13763  onBoxEnd(t) {
13764    const s = (
13765      /** @type {!import("../View.js").default} */
13766      this.getMap().getView()
13767    );
13768    let n = this.getGeometry();
13769    if (this.out_) {
13770      const r = s.rotatedExtentForGeometry(n), o = s.getResolutionForExtentInternal(r), a = s.getResolution() / o;
13771      n = n.clone(), n.scale(a * a);
13772    }
13773    s.fitInternal(n, {
13774      duration: this.duration_,
13775      easing: Pn
13776    });
13777  }
13778}
13779const nC = sC, as = {
13780  LEFT: "ArrowLeft",
13781  UP: "ArrowUp",
13782  RIGHT: "ArrowRight",
13783  DOWN: "ArrowDown"
13784};
13785class rC extends Or {
13786  /**
13787   * @param {Options} [options] Options.
13788   */
13789  constructor(t) {
13790    super(), t = t || {}, this.defaultCondition_ = function(i) {
13791      return $h(i) && xg(i);
13792    }, this.condition_ = t.condition !== void 0 ? t.condition : this.defaultCondition_, this.duration_ = t.duration !== void 0 ? t.duration : 100, this.pixelDelta_ = t.pixelDelta !== void 0 ? t.pixelDelta : 128;
13793  }
13794  /**
13795   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
13796   * `KeyEvent`, and decides the direction to pan to (if an arrow key was
13797   * pressed).
13798   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13799   * @return {boolean} `false` to stop event propagation.
13800   */
13801  handleEvent(t) {
13802    let i = !1;
13803    if (t.type == et.KEYDOWN) {
13804      const s = (
13805        /** @type {KeyboardEvent} */
13806        t.originalEvent
13807      ), n = s.key;
13808      if (this.condition_(t) && (n == as.DOWN || n == as.LEFT || n == as.RIGHT || n == as.UP)) {
13809        const o = t.map.getView(), a = o.getResolution() * this.pixelDelta_;
13810        let l = 0, h = 0;
13811        n == as.DOWN ? h = -a : n == as.LEFT ? l = -a : n == as.RIGHT ? l = a : h = a;
13812        const c = [l, h];
13813        Jl(c, o.getRotation()), WM(o, c, this.duration_), s.preventDefault(), i = !0;
13814      }
13815    }
13816    return !i;
13817  }
13818}
13819const oC = rC;
13820class aC extends Or {
13821  /**
13822   * @param {Options} [options] Options.
13823   */
13824  constructor(t) {
13825    super(), t = t || {}, this.condition_ = t.condition ? t.condition : xg, this.delta_ = t.delta ? t.delta : 1, this.duration_ = t.duration !== void 0 ? t.duration : 100;
13826  }
13827  /**
13828   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
13829   * `KeyEvent`, and decides whether to zoom in or out (depending on whether the
13830   * key pressed was '+' or '-').
13831   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13832   * @return {boolean} `false` to stop event propagation.
13833   */
13834  handleEvent(t) {
13835    let i = !1;
13836    if (t.type == et.KEYDOWN || t.type == et.KEYPRESS) {
13837      const s = (
13838        /** @type {KeyboardEvent} */
13839        t.originalEvent
13840      ), n = s.key;
13841      if (this.condition_(t) && (n === "+" || n === "-")) {
13842        const r = t.map, o = n === "+" ? this.delta_ : -this.delta_, a = r.getView();
13843        Uh(a, o, void 0, this.duration_), s.preventDefault(), i = !0;
13844      }
13845    }
13846    return !i;
13847  }
13848}
13849const lC = aC;
13850class hC {
13851  /**
13852   * @param {number} decay Rate of decay (must be negative).
13853   * @param {number} minVelocity Minimum velocity (pixels/millisecond).
13854   * @param {number} delay Delay to consider to calculate the kinetic
13855   *     initial values (milliseconds).
13856   */
13857  constructor(t, i, s) {
13858    this.decay_ = t, this.minVelocity_ = i, this.delay_ = s, this.points_ = [], this.angle_ = 0, this.initialVelocity_ = 0;
13859  }
13860  /**
13861   * FIXME empty description for jsdoc
13862   */
13863  begin() {
13864    this.points_.length = 0, this.angle_ = 0, this.initialVelocity_ = 0;
13865  }
13866  /**
13867   * @param {number} x X.
13868   * @param {number} y Y.
13869   */
13870  update(t, i) {
13871    this.points_.push(t, i, Date.now());
13872  }
13873  /**
13874   * @return {boolean} Whether we should do kinetic animation.
13875   */
13876  end() {
13877    if (this.points_.length < 6)
13878      return !1;
13879    const t = Date.now() - this.delay_, i = this.points_.length - 3;
13880    if (this.points_[i + 2] < t)
13881      return !1;
13882    let s = i - 3;
13883    for (; s > 0 && this.points_[s + 2] > t; )
13884      s -= 3;
13885    const n = this.points_[i + 2] - this.points_[s + 2];
13886    if (n < 1e3 / 60)
13887      return !1;
13888    const r = this.points_[i] - this.points_[s], o = this.points_[i + 1] - this.points_[s + 1];
13889    return this.angle_ = Math.atan2(o, r), this.initialVelocity_ = Math.sqrt(r * r + o * o) / n, this.initialVelocity_ > this.minVelocity_;
13890  }
13891  /**
13892   * @return {number} Total distance travelled (pixels).
13893   */
13894  getDistance() {
13895    return (this.minVelocity_ - this.initialVelocity_) / this.decay_;
13896  }
13897  /**
13898   * @return {number} Angle of the kinetic panning animation (radians).
13899   */
13900  getAngle() {
13901    return this.angle_;
13902  }
13903}
13904const cC = hC;
13905class uC extends Or {
13906  /**
13907   * @param {Options} [options] Options.
13908   */
13909  constructor(t) {
13910    t = t || {}, super(
13911      /** @type {import("./Interaction.js").InteractionOptions} */
13912      t
13913    ), this.totalDelta_ = 0, this.lastDelta_ = 0, this.maxDelta_ = t.maxDelta !== void 0 ? t.maxDelta : 1, this.duration_ = t.duration !== void 0 ? t.duration : 250, this.timeout_ = t.timeout !== void 0 ? t.timeout : 80, this.useAnchor_ = t.useAnchor !== void 0 ? t.useAnchor : !0, this.constrainResolution_ = t.constrainResolution !== void 0 ? t.constrainResolution : !1;
13914    const i = t.condition ? t.condition : jo;
13915    this.condition_ = t.onFocusOnly ? Fl(mg, i) : i, this.lastAnchor_ = null, this.startTime_ = void 0, this.timeoutId_, this.mode_ = void 0, this.trackpadEventGap_ = 400, this.trackpadTimeoutId_, this.deltaPerZoom_ = 300;
13916  }
13917  /**
13918   * @private
13919   */
13920  endInteraction_() {
13921    this.trackpadTimeoutId_ = void 0;
13922    const t = this.getMap();
13923    if (!t)
13924      return;
13925    t.getView().endInteraction(
13926      void 0,
13927      this.lastDelta_ ? this.lastDelta_ > 0 ? 1 : -1 : 0,
13928      this.lastAnchor_
13929    );
13930  }
13931  /**
13932   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
13933   * zooms the map.
13934   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
13935   * @return {boolean} `false` to stop event propagation.
13936   */
13937  handleEvent(t) {
13938    if (!this.condition_(t) || t.type !== et.WHEEL)
13939      return !0;
13940    const s = t.map, n = (
13941      /** @type {WheelEvent} */
13942      t.originalEvent
13943    );
13944    n.preventDefault(), this.useAnchor_ && (this.lastAnchor_ = t.coordinate);
13945    let r;
13946    if (t.type == et.WHEEL && (r = n.deltaY, dE && n.deltaMode === WheelEvent.DOM_DELTA_PIXEL && (r /= qf), n.deltaMode === WheelEvent.DOM_DELTA_LINE && (r *= 40)), r === 0)
13947      return !1;
13948    this.lastDelta_ = r;
13949    const o = Date.now();
13950    this.startTime_ === void 0 && (this.startTime_ = o), (!this.mode_ || o - this.startTime_ > this.trackpadEventGap_) && (this.mode_ = Math.abs(r) < 4 ? "trackpad" : "wheel");
13951    const a = s.getView();
13952    if (this.mode_ === "trackpad" && !(a.getConstrainResolution() || this.constrainResolution_))
13953      return this.trackpadTimeoutId_ ? clearTimeout(this.trackpadTimeoutId_) : (a.getAnimating() && a.cancelAnimations(), a.beginInteraction()), this.trackpadTimeoutId_ = setTimeout(
13954        this.endInteraction_.bind(this),
13955        this.timeout_
13956      ), a.adjustZoom(-r / this.deltaPerZoom_, this.lastAnchor_), this.startTime_ = o, !1;
13957    this.totalDelta_ += r;
13958    const l = Math.max(this.timeout_ - (o - this.startTime_), 0);
13959    return clearTimeout(this.timeoutId_), this.timeoutId_ = setTimeout(
13960      this.handleWheelZoom_.bind(this, s),
13961      l
13962    ), !1;
13963  }
13964  /**
13965   * @private
13966   * @param {import("../Map.js").default} map Map.
13967   */
13968  handleWheelZoom_(t) {
13969    const i = t.getView();
13970    i.getAnimating() && i.cancelAnimations();
13971    let s = -Ot(
13972      this.totalDelta_,
13973      -this.maxDelta_ * this.deltaPerZoom_,
13974      this.maxDelta_ * this.deltaPerZoom_
13975    ) / this.deltaPerZoom_;
13976    (i.getConstrainResolution() || this.constrainResolution_) && (s = s ? s > 0 ? 1 : -1 : 0), Uh(i, s, this.lastAnchor_, this.duration_), this.mode_ = void 0, this.totalDelta_ = 0, this.lastAnchor_ = null, this.startTime_ = void 0, this.timeoutId_ = void 0;
13977  }
13978  /**
13979   * Enable or disable using the mouse's location as an anchor when zooming
13980   * @param {boolean} useAnchor true to zoom to the mouse's location, false
13981   * to zoom to the center of the map
13982   * @api
13983   */
13984  setMouseAnchor(t) {
13985    this.useAnchor_ = t, t || (this.lastAnchor_ = null);
13986  }
13987}
13988const dC = uC;
13989class fC extends is {
13990  /**
13991   * @param {Options} [options] Options.
13992   */
13993  constructor(t) {
13994    t = t || {};
13995    const i = (
13996      /** @type {import("./Pointer.js").Options} */
13997      t
13998    );
13999    i.stopDown || (i.stopDown = As), super(i), this.anchor_ = null, this.lastAngle_ = void 0, this.rotating_ = !1, this.rotationDelta_ = 0, this.threshold_ = t.threshold !== void 0 ? t.threshold : 0.3, this.duration_ = t.duration !== void 0 ? t.duration : 250;
14000  }
14001  /**
14002   * Handle pointer drag events.
14003   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14004   */
14005  handleDragEvent(t) {
14006    let i = 0;
14007    const s = this.targetPointers[0], n = this.targetPointers[1], r = Math.atan2(
14008      n.clientY - s.clientY,
14009      n.clientX - s.clientX
14010    );
14011    if (this.lastAngle_ !== void 0) {
14012      const l = r - this.lastAngle_;
14013      this.rotationDelta_ += l, !this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_ && (this.rotating_ = !0), i = l;
14014    }
14015    this.lastAngle_ = r;
14016    const o = t.map, a = o.getView();
14017    a.getConstraints().rotation !== Ih && (this.anchor_ = o.getCoordinateFromPixelInternal(
14018      o.getEventPixel(Xh(this.targetPointers))
14019    ), this.rotating_ && (o.render(), a.adjustRotationInternal(i, this.anchor_)));
14020  }
14021  /**
14022   * Handle pointer up events.
14023   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14024   * @return {boolean} If the event was consumed.
14025   */
14026  handleUpEvent(t) {
14027    return this.targetPointers.length < 2 ? (t.map.getView().endInteraction(this.duration_), !1) : !0;
14028  }
14029  /**
14030   * Handle pointer down events.
14031   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14032   * @return {boolean} If the event was consumed.
14033   */
14034  handleDownEvent(t) {
14035    if (this.targetPointers.length >= 2) {
14036      const i = t.map;
14037      return this.anchor_ = null, this.lastAngle_ = void 0, this.rotating_ = !1, this.rotationDelta_ = 0, this.handlingDownUpSequence || i.getView().beginInteraction(), !0;
14038    }
14039    return !1;
14040  }
14041}
14042const gC = fC;
14043class _C extends is {
14044  /**
14045   * @param {Options} [options] Options.
14046   */
14047  constructor(t) {
14048    t = t || {};
14049    const i = (
14050      /** @type {import("./Pointer.js").Options} */
14051      t
14052    );
14053    i.stopDown || (i.stopDown = As), super(i), this.anchor_ = null, this.duration_ = t.duration !== void 0 ? t.duration : 400, this.lastDistance_ = void 0, this.lastScaleDelta_ = 1;
14054  }
14055  /**
14056   * Handle pointer drag events.
14057   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14058   */
14059  handleDragEvent(t) {
14060    let i = 1;
14061    const s = this.targetPointers[0], n = this.targetPointers[1], r = s.clientX - n.clientX, o = s.clientY - n.clientY, a = Math.sqrt(r * r + o * o);
14062    this.lastDistance_ !== void 0 && (i = this.lastDistance_ / a), this.lastDistance_ = a;
14063    const l = t.map, h = l.getView();
14064    i != 1 && (this.lastScaleDelta_ = i), this.anchor_ = l.getCoordinateFromPixelInternal(
14065      l.getEventPixel(Xh(this.targetPointers))
14066    ), l.render(), h.adjustResolutionInternal(i, this.anchor_);
14067  }
14068  /**
14069   * Handle pointer up events.
14070   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14071   * @return {boolean} If the event was consumed.
14072   */
14073  handleUpEvent(t) {
14074    if (this.targetPointers.length < 2) {
14075      const s = t.map.getView(), n = this.lastScaleDelta_ > 1 ? 1 : -1;
14076      return s.endInteraction(this.duration_, n), !1;
14077    }
14078    return !0;
14079  }
14080  /**
14081   * Handle pointer down events.
14082   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
14083   * @return {boolean} If the event was consumed.
14084   */
14085  handleDownEvent(t) {
14086    if (this.targetPointers.length >= 2) {
14087      const i = t.map;
14088      return this.anchor_ = null, this.lastDistance_ = void 0, this.lastScaleDelta_ = 1, this.handlingDownUpSequence || i.getView().beginInteraction(), !0;
14089    }
14090    return !1;
14091  }
14092}
14093const mC = _C;
14094function pC(e) {
14095  e = e || {};
14096  const t = new Pe(), i = new cC(-5e-3, 0.05, 100);
14097  return (e.altShiftDragRotate !== void 0 ? e.altShiftDragRotate : !0) && t.push(new JM()), (e.doubleClickZoom !== void 0 ? e.doubleClickZoom : !0) && t.push(
14098    new _g({
14099      delta: e.zoomDelta,
14100      duration: e.zoomDuration
14101    })
14102  ), (e.dragPan !== void 0 ? e.dragPan : !0) && t.push(
14103    new HM({
14104      onFocusOnly: e.onFocusOnly,
14105      kinetic: i
14106    })
14107  ), (e.pinchRotate !== void 0 ? e.pinchRotate : !0) && t.push(new gC()), (e.pinchZoom !== void 0 ? e.pinchZoom : !0) && t.push(
14108    new mC({
14109      duration: e.zoomDuration
14110    })
14111  ), (e.keyboard !== void 0 ? e.keyboard : !0) && (t.push(new oC()), t.push(
14112    new lC({
14113      delta: e.zoomDelta,
14114      duration: e.zoomDuration
14115    })
14116  )), (e.mouseWheelZoom !== void 0 ? e.mouseWheelZoom : !0) && t.push(
14117    new dC({
14118      onFocusOnly: e.onFocusOnly,
14119      duration: e.zoomDuration
14120    })
14121  ), (e.shiftDragZoom !== void 0 ? e.shiftDragZoom : !0) && t.push(
14122    new nC({
14123      duration: e.zoomDuration
14124    })
14125  ), t;
14126}
14127function Fu(e, t, i) {
14128  return i === void 0 && (i = [0, 0]), i[0] = e[0] + 2 * t, i[1] = e[1] + 2 * t, i;
14129}
14130function ku(e) {
14131  return e[0] > 0 && e[1] > 0;
14132}
14133function Eg(e, t, i) {
14134  return i === void 0 && (i = [0, 0]), i[0] = e[0] * t + 0.5 | 0, i[1] = e[1] * t + 0.5 | 0, i;
14135}
14136function ye(e, t) {
14137  return Array.isArray(e) ? e : (t === void 0 ? t = [e, e] : (t[0] = e, t[1] = e), t);
14138}
14139function Mg(e) {
14140  if (e instanceof Lr) {
14141    e.setMapInternal(null);
14142    return;
14143  }
14144  e instanceof ya && e.getLayers().forEach(Mg);
14145}
14146function Cg(e, t) {
14147  if (e instanceof Lr) {
14148    e.setMapInternal(t);
14149    return;
14150  }
14151  if (e instanceof ya) {
14152    const i = e.getLayers().getArray();
14153    for (let s = 0, n = i.length; s < n; ++s)
14154      Cg(i[s], t);
14155  }
14156}
14157let yC = class extends ni {
14158  /**
14159   * @param {MapOptions} [options] Map options.
14160   */
14161  constructor(t) {
14162    super(), t = t || {}, this.on, this.once, this.un;
14163    const i = xC(t);
14164    this.renderComplete_, this.loaded_ = !0, this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this), this.maxTilesLoading_ = t.maxTilesLoading !== void 0 ? t.maxTilesLoading : 16, this.pixelRatio_ = t.pixelRatio !== void 0 ? t.pixelRatio : qf, this.postRenderTimeoutHandle_, this.animationDelayKey_, this.animationDelay_ = this.animationDelay_.bind(this), this.coordinateToPixelTransform_ = Qe(), this.pixelToCoordinateTransform_ = Qe(), this.frameIndex_ = 0, this.frameState_ = null, this.previousExtent_ = null, this.viewPropertyListenerKey_ = null, this.viewChangeListenerKey_ = null, this.layerGroupPropertyListenerKeys_ = null, this.viewport_ = document.createElement("div"), this.viewport_.className = "ol-viewport" + ("ontouchstart" in window ? " ol-touch" : ""), this.viewport_.style.position = "relative", this.viewport_.style.overflow = "hidden", this.viewport_.style.width = "100%", this.viewport_.style.height = "100%", this.overlayContainer_ = document.createElement("div"), this.overlayContainer_.style.position = "absolute", this.overlayContainer_.style.zIndex = "0", this.overlayContainer_.style.width = "100%", this.overlayContainer_.style.height = "100%", this.overlayContainer_.style.pointerEvents = "none", this.overlayContainer_.className = "ol-overlaycontainer", this.viewport_.appendChild(this.overlayContainer_), this.overlayContainerStopEvent_ = document.createElement("div"), this.overlayContainerStopEvent_.style.position = "absolute", this.overlayContainerStopEvent_.style.zIndex = "0", this.overlayContainerStopEvent_.style.width = "100%", this.overlayContainerStopEvent_.style.height = "100%", this.overlayContainerStopEvent_.style.pointerEvents = "none", this.overlayContainerStopEvent_.className = "ol-overlaycontainer-stopevent", this.viewport_.appendChild(this.overlayContainerStopEvent_), this.mapBrowserEventHandler_ = null, this.moveTolerance_ = t.moveTolerance, this.keyboardEventTarget_ = i.keyboardEventTarget, this.targetChangeHandlerKeys_ = null, this.targetElement_ = null, this.resizeObserver_ = new ResizeObserver(() => this.updateSize()), this.controls = i.controls || zM(), this.interactions = i.interactions || pC({
14165      onFocusOnly: !0
14166    }), this.overlays_ = i.overlays, this.overlayIdIndex_ = {}, this.renderer_ = null, this.postRenderFunctions_ = [], this.tileQueue_ = new PM(
14167      this.getTilePriority.bind(this),
14168      this.handleTileChange_.bind(this)
14169    ), this.addChangeListener(
14170      Qt.LAYERGROUP,
14171      this.handleLayerGroupChanged_
14172    ), this.addChangeListener(Qt.VIEW, this.handleViewChanged_), this.addChangeListener(Qt.SIZE, this.handleSizeChanged_), this.addChangeListener(Qt.TARGET, this.handleTargetChanged_), this.setProperties(i.values);
14173    const s = this;
14174    t.view && !(t.view instanceof qe) && t.view.then(function(n) {
14175      s.setView(new qe(n));
14176    }), this.controls.addEventListener(
14177      $t.ADD,
14178      /**
14179       * @param {import("./Collection.js").CollectionEvent<import("./control/Control.js").default>} event CollectionEvent
14180       */
14181      (n) => {
14182        n.element.setMap(this);
14183      }
14184    ), this.controls.addEventListener(
14185      $t.REMOVE,
14186      /**
14187       * @param {import("./Collection.js").CollectionEvent<import("./control/Control.js").default>} event CollectionEvent.
14188       */
14189      (n) => {
14190        n.element.setMap(null);
14191      }
14192    ), this.interactions.addEventListener(
14193      $t.ADD,
14194      /**
14195       * @param {import("./Collection.js").CollectionEvent<import("./interaction/Interaction.js").default>} event CollectionEvent.
14196       */
14197      (n) => {
14198        n.element.setMap(this);
14199      }
14200    ), this.interactions.addEventListener(
14201      $t.REMOVE,
14202      /**
14203       * @param {import("./Collection.js").CollectionEvent<import("./interaction/Interaction.js").default>} event CollectionEvent.
14204       */
14205      (n) => {
14206        n.element.setMap(null);
14207      }
14208    ), this.overlays_.addEventListener(
14209      $t.ADD,
14210      /**
14211       * @param {import("./Collection.js").CollectionEvent<import("./Overlay.js").default>} event CollectionEvent.
14212       */
14213      (n) => {
14214        this.addOverlayInternal_(n.element);
14215      }
14216    ), this.overlays_.addEventListener(
14217      $t.REMOVE,
14218      /**
14219       * @param {import("./Collection.js").CollectionEvent<import("./Overlay.js").default>} event CollectionEvent.
14220       */
14221      (n) => {
14222        const r = n.element.getId();
14223        r !== void 0 && delete this.overlayIdIndex_[r.toString()], n.element.setMap(null);
14224      }
14225    ), this.controls.forEach(
14226      /**
14227       * @param {import("./control/Control.js").default} control Control.
14228       */
14229      (n) => {
14230        n.setMap(this);
14231      }
14232    ), this.interactions.forEach(
14233      /**
14234       * @param {import("./interaction/Interaction.js").default} interaction Interaction.
14235       */
14236      (n) => {
14237        n.setMap(this);
14238      }
14239    ), this.overlays_.forEach(this.addOverlayInternal_.bind(this));
14240  }
14241  /**
14242   * Add the given control to the map.
14243   * @param {import("./control/Control.js").default} control Control.
14244   * @api
14245   */
14246  addControl(t) {
14247    this.getControls().push(t);
14248  }
14249  /**
14250   * Add the given interaction to the map. If you want to add an interaction
14251   * at another point of the collection use `getInteractions()` and the methods
14252   * available on {@link module:ol/Collection~Collection}. This can be used to
14253   * stop the event propagation from the handleEvent function. The interactions
14254   * get to handle the events in the reverse order of this collection.
14255   * @param {import("./interaction/Interaction.js").default} interaction Interaction to add.
14256   * @api
14257   */
14258  addInteraction(t) {
14259    this.getInteractions().push(t);
14260  }
14261  /**
14262   * Adds the given layer to the top of this map. If you want to add a layer
14263   * elsewhere in the stack, use `getLayers()` and the methods available on
14264   * {@link module:ol/Collection~Collection}.
14265   * @param {import("./layer/Base.js").default} layer Layer.
14266   * @api
14267   */
14268  addLayer(t) {
14269    this.getLayerGroup().getLayers().push(t);
14270  }
14271  /**
14272   * @param {import("./layer/Group.js").GroupEvent} event The layer add event.
14273   * @private
14274   */
14275  handleLayerAdd_(t) {
14276    Cg(t.layer, this);
14277  }
14278  /**
14279   * Add the given overlay to the map.
14280   * @param {import("./Overlay.js").default} overlay Overlay.
14281   * @api
14282   */
14283  addOverlay(t) {
14284    this.getOverlays().push(t);
14285  }
14286  /**
14287   * This deals with map's overlay collection changes.
14288   * @param {import("./Overlay.js").default} overlay Overlay.
14289   * @private
14290   */
14291  addOverlayInternal_(t) {
14292    const i = t.getId();
14293    i !== void 0 && (this.overlayIdIndex_[i.toString()] = t), t.setMap(this);
14294  }
14295  /**
14296   *
14297   * Clean up.
14298   */
14299  disposeInternal() {
14300    this.controls.clear(), this.interactions.clear(), this.overlays_.clear(), this.resizeObserver_.disconnect(), this.setTarget(null), super.disposeInternal();
14301  }
14302  /**
14303   * Detect features that intersect a pixel on the viewport, and execute a
14304   * callback with each intersecting feature. Layers included in the detection can
14305   * be configured through the `layerFilter` option in `options`.
14306   * @param {import("./pixel.js").Pixel} pixel Pixel.
14307   * @param {function(import("./Feature.js").FeatureLike, import("./layer/Layer.js").default<import("./source/Source").default>, import("./geom/SimpleGeometry.js").default): T} callback Feature callback. The callback will be
14308   *     called with two arguments. The first argument is one
14309   *     {@link module:ol/Feature~Feature feature} or
14310   *     {@link module:ol/render/Feature~RenderFeature render feature} at the pixel, the second is
14311   *     the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for
14312   *     unmanaged layers. To stop detection, callback functions can return a
14313   *     truthy value.
14314   * @param {AtPixelOptions} [options] Optional options.
14315   * @return {T|undefined} Callback result, i.e. the return value of last
14316   * callback execution, or the first truthy callback return value.
14317   * @template T
14318   * @api
14319   */
14320  forEachFeatureAtPixel(t, i, s) {
14321    if (!this.frameState_ || !this.renderer_)
14322      return;
14323    const n = this.getCoordinateFromPixelInternal(t);
14324    s = s !== void 0 ? s : {};
14325    const r = s.hitTolerance !== void 0 ? s.hitTolerance : 0, o = s.layerFilter !== void 0 ? s.layerFilter : Ss, a = s.checkWrapped !== !1;
14326    return this.renderer_.forEachFeatureAtCoordinate(
14327      n,
14328      this.frameState_,
14329      r,
14330      a,
14331      i,
14332      null,
14333      o,
14334      null
14335    );
14336  }
14337  /**
14338   * Get all features that intersect a pixel on the viewport.
14339   * @param {import("./pixel.js").Pixel} pixel Pixel.
14340   * @param {AtPixelOptions} [options] Optional options.
14341   * @return {Array<import("./Feature.js").FeatureLike>} The detected features or
14342   * an empty array if none were found.
14343   * @api
14344   */
14345  getFeaturesAtPixel(t, i) {
14346    const s = [];
14347    return this.forEachFeatureAtPixel(
14348      t,
14349      function(n) {
14350        s.push(n);
14351      },
14352      i
14353    ), s;
14354  }
14355  /**
14356   * Get all layers from all layer groups.
14357   * @return {Array<import("./layer/Layer.js").default>} Layers.
14358   * @api
14359   */
14360  getAllLayers() {
14361    const t = [];
14362    function i(s) {
14363      s.forEach(function(n) {
14364        n instanceof ya ? i(n.getLayers()) : t.push(n);
14365      });
14366    }
14367    return i(this.getLayers()), t;
14368  }
14369  /**
14370   * Detect if features intersect a pixel on the viewport. Layers included in the
14371   * detection can be configured through the `layerFilter` option.
14372   * @param {import("./pixel.js").Pixel} pixel Pixel.
14373   * @param {AtPixelOptions} [options] Optional options.
14374   * @return {boolean} Is there a feature at the given pixel?
14375   * @api
14376   */
14377  hasFeatureAtPixel(t, i) {
14378    if (!this.frameState_ || !this.renderer_)
14379      return !1;
14380    const s = this.getCoordinateFromPixelInternal(t);
14381    i = i !== void 0 ? i : {};
14382    const n = i.layerFilter !== void 0 ? i.layerFilter : Ss, r = i.hitTolerance !== void 0 ? i.hitTolerance : 0, o = i.checkWrapped !== !1;
14383    return this.renderer_.hasFeatureAtCoordinate(
14384      s,
14385      this.frameState_,
14386      r,
14387      o,
14388      n,
14389      null
14390    );
14391  }
14392  /**
14393   * Returns the coordinate in user projection for a browser event.
14394   * @param {MouseEvent} event Event.
14395   * @return {import("./coordinate.js").Coordinate} Coordinate.
14396   * @api
14397   */
14398  getEventCoordinate(t) {
14399    return this.getCoordinateFromPixel(this.getEventPixel(t));
14400  }
14401  /**
14402   * Returns the coordinate in view projection for a browser event.
14403   * @param {MouseEvent} event Event.
14404   * @return {import("./coordinate.js").Coordinate} Coordinate.
14405   */
14406  getEventCoordinateInternal(t) {
14407    return this.getCoordinateFromPixelInternal(this.getEventPixel(t));
14408  }
14409  /**
14410   * Returns the map pixel position for a browser event relative to the viewport.
14411   * @param {UIEvent|{clientX: number, clientY: number}} event Event.
14412   * @return {import("./pixel.js").Pixel} Pixel.
14413   * @api
14414   */
14415  getEventPixel(t) {
14416    const s = this.viewport_.getBoundingClientRect(), n = this.getSize(), r = s.width / n[0], o = s.height / n[1], a = (
14417      //FIXME Are we really calling this with a TouchEvent anywhere?
14418      "changedTouches" in t ? (
14419        /** @type {TouchEvent} */
14420        t.changedTouches[0]
14421      ) : (
14422        /** @type {MouseEvent} */
14423        t
14424      )
14425    );
14426    return [
14427      (a.clientX - s.left) / r,
14428      (a.clientY - s.top) / o
14429    ];
14430  }
14431  /**
14432   * Get the target in which this map is rendered.
14433   * Note that this returns what is entered as an option or in setTarget:
14434   * if that was an element, it returns an element; if a string, it returns that.
14435   * @return {HTMLElement|string|undefined} The Element or id of the Element that the
14436   *     map is rendered in.
14437   * @observable
14438   * @api
14439   */
14440  getTarget() {
14441    return (
14442      /** @type {HTMLElement|string|undefined} */
14443      this.get(Qt.TARGET)
14444    );
14445  }
14446  /**
14447   * Get the DOM element into which this map is rendered. In contrast to
14448   * `getTarget` this method always return an `Element`, or `null` if the
14449   * map has no target.
14450   * @return {HTMLElement} The element that the map is rendered in.
14451   * @api
14452   */
14453  getTargetElement() {
14454    return this.targetElement_;
14455  }
14456  /**
14457   * Get the coordinate for a given pixel.  This returns a coordinate in the
14458   * user projection.
14459   * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
14460   * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
14461   * @api
14462   */
14463  getCoordinateFromPixel(t) {
14464    return Cs(
14465      this.getCoordinateFromPixelInternal(t),
14466      this.getView().getProjection()
14467    );
14468  }
14469  /**
14470   * Get the coordinate for a given pixel.  This returns a coordinate in the
14471   * map view projection.
14472   * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
14473   * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
14474   */
14475  getCoordinateFromPixelInternal(t) {
14476    const i = this.frameState_;
14477    return i ? zt(i.pixelToCoordinateTransform, t.slice()) : null;
14478  }
14479  /**
14480   * Get the map controls. Modifying this collection changes the controls
14481   * associated with the map.
14482   * @return {Collection<import("./control/Control.js").default>} Controls.
14483   * @api
14484   */
14485  getControls() {
14486    return this.controls;
14487  }
14488  /**
14489   * Get the map overlays. Modifying this collection changes the overlays
14490   * associated with the map.
14491   * @return {Collection<import("./Overlay.js").default>} Overlays.
14492   * @api
14493   */
14494  getOverlays() {
14495    return this.overlays_;
14496  }
14497  /**
14498   * Get an overlay by its identifier (the value returned by overlay.getId()).
14499   * Note that the index treats string and numeric identifiers as the same. So
14500   * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.
14501   * @param {string|number} id Overlay identifier.
14502   * @return {import("./Overlay.js").default} Overlay.
14503   * @api
14504   */
14505  getOverlayById(t) {
14506    const i = this.overlayIdIndex_[t.toString()];
14507    return i !== void 0 ? i : null;
14508  }
14509  /**
14510   * Get the map interactions. Modifying this collection changes the interactions
14511   * associated with the map.
14512   *
14513   * Interactions are used for e.g. pan, zoom and rotate.
14514   * @return {Collection<import("./interaction/Interaction.js").default>} Interactions.
14515   * @api
14516   */
14517  getInteractions() {
14518    return this.interactions;
14519  }
14520  /**
14521   * Get the layergroup associated with this map.
14522   * @return {LayerGroup} A layer group containing the layers in this map.
14523   * @observable
14524   * @api
14525   */
14526  getLayerGroup() {
14527    return (
14528      /** @type {LayerGroup} */
14529      this.get(Qt.LAYERGROUP)
14530    );
14531  }
14532  /**
14533   * Clear any existing layers and add layers to the map.
14534   * @param {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>} layers The layers to be added to the map.
14535   * @api
14536   */
14537  setLayers(t) {
14538    const i = this.getLayerGroup();
14539    if (t instanceof Pe) {
14540      i.setLayers(t);
14541      return;
14542    }
14543    const s = i.getLayers();
14544    s.clear(), s.extend(t);
14545  }
14546  /**
14547   * Get the collection of layers associated with this map.
14548   * @return {!Collection<import("./layer/Base.js").default>} Layers.
14549   * @api
14550   */
14551  getLayers() {
14552    return this.getLayerGroup().getLayers();
14553  }
14554  /**
14555   * @return {boolean} Layers have sources that are still loading.
14556   */
14557  getLoadingOrNotReady() {
14558    const t = this.getLayerGroup().getLayerStatesArray();
14559    for (let i = 0, s = t.length; i < s; ++i) {
14560      const n = t[i];
14561      if (!n.visible)
14562        continue;
14563      const r = n.layer.getRenderer();
14564      if (r && !r.ready)
14565        return !0;
14566      const o = n.layer.getSource();
14567      if (o && o.loading)
14568        return !0;
14569    }
14570    return !1;
14571  }
14572  /**
14573   * Get the pixel for a coordinate.  This takes a coordinate in the user
14574   * projection and returns the corresponding pixel.
14575   * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
14576   * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
14577   * @api
14578   */
14579  getPixelFromCoordinate(t) {
14580    const i = Pt(
14581      t,
14582      this.getView().getProjection()
14583    );
14584    return this.getPixelFromCoordinateInternal(i);
14585  }
14586  /**
14587   * Get the pixel for a coordinate.  This takes a coordinate in the map view
14588   * projection and returns the corresponding pixel.
14589   * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
14590   * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
14591   */
14592  getPixelFromCoordinateInternal(t) {
14593    const i = this.frameState_;
14594    return i ? zt(
14595      i.coordinateToPixelTransform,
14596      t.slice(0, 2)
14597    ) : null;
14598  }
14599  /**
14600   * Get the map renderer.
14601   * @return {import("./renderer/Map.js").default|null} Renderer
14602   */
14603  getRenderer() {
14604    return this.renderer_;
14605  }
14606  /**
14607   * Get the size of this map.
14608   * @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM.
14609   * @observable
14610   * @api
14611   */
14612  getSize() {
14613    return (
14614      /** @type {import("./size.js").Size|undefined} */
14615      this.get(Qt.SIZE)
14616    );
14617  }
14618  /**
14619   * Get the view associated with this map. A view manages properties such as
14620   * center and resolution.
14621   * @return {View} The view that controls this map.
14622   * @observable
14623   * @api
14624   */
14625  getView() {
14626    return (
14627      /** @type {View} */
14628      this.get(Qt.VIEW)
14629    );
14630  }
14631  /**
14632   * Get the element that serves as the map viewport.
14633   * @return {HTMLElement} Viewport.
14634   * @api
14635   */
14636  getViewport() {
14637    return this.viewport_;
14638  }
14639  /**
14640   * Get the element that serves as the container for overlays.  Elements added to
14641   * this container will let mousedown and touchstart events through to the map,
14642   * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}
14643   * events.
14644   * @return {!HTMLElement} The map's overlay container.
14645   */
14646  getOverlayContainer() {
14647    return this.overlayContainer_;
14648  }
14649  /**
14650   * Get the element that serves as a container for overlays that don't allow
14651   * event propagation. Elements added to this container won't let mousedown and
14652   * touchstart events through to the map, so clicks and gestures on an overlay
14653   * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
14654   * @return {!HTMLElement} The map's overlay container that stops events.
14655   */
14656  getOverlayContainerStopEvent() {
14657    return this.overlayContainerStopEvent_;
14658  }
14659  /**
14660   * @return {!Document} The document where the map is displayed.
14661   */
14662  getOwnerDocument() {
14663    const t = this.getTargetElement();
14664    return t ? t.ownerDocument : document;
14665  }
14666  /**
14667   * @param {import("./Tile.js").default} tile Tile.
14668   * @param {string} tileSourceKey Tile source key.
14669   * @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
14670   * @param {number} tileResolution Tile resolution.
14671   * @return {number} Tile priority.
14672   */
14673  getTilePriority(t, i, s, n) {
14674    return AM(
14675      this.frameState_,
14676      t,
14677      i,
14678      s,
14679      n
14680    );
14681  }
14682  /**
14683   * @param {UIEvent} browserEvent Browser event.
14684   * @param {string} [type] Type.
14685   */
14686  handleBrowserEvent(t, i) {
14687    i = i || t.type;
14688    const s = new ui(i, this, t);
14689    this.handleMapBrowserEvent(s);
14690  }
14691  /**
14692   * @param {MapBrowserEvent} mapBrowserEvent The event to handle.
14693   */
14694  handleMapBrowserEvent(t) {
14695    if (!this.frameState_)
14696      return;
14697    const i = (
14698      /** @type {PointerEvent} */
14699      t.originalEvent
14700    ), s = i.type;
14701    if (s === Ll.POINTERDOWN || s === et.WHEEL || s === et.KEYDOWN) {
14702      const n = this.getOwnerDocument(), r = this.viewport_.getRootNode ? this.viewport_.getRootNode() : n, o = (
14703        /** @type {Node} */
14704        i.target
14705      );
14706      if (
14707        // Abort if the target is a child of the container for elements whose events are not meant
14708        // to be handled by map interactions.
14709        this.overlayContainerStopEvent_.contains(o) || // Abort if the event target is a child of the container that is no longer in the page.
14710        // It's possible for the target to no longer be in the page if it has been removed in an
14711        // event listener, this might happen in a Control that recreates it's content based on
14712        // user interaction either manually or via a render in something like https://reactjs.org/
14713        !(r === n ? n.documentElement : r).contains(o)
14714      )
14715        return;
14716    }
14717    if (t.frameState = this.frameState_, this.dispatchEvent(t) !== !1) {
14718      const n = this.getInteractions().getArray().slice();
14719      for (let r = n.length - 1; r >= 0; r--) {
14720        const o = n[r];
14721        if (o.getMap() !== this || !o.getActive() || !this.getTargetElement())
14722          continue;
14723        if (!o.handleEvent(t) || t.propagationStopped)
14724          break;
14725      }
14726    }
14727  }
14728  /**
14729   * @protected
14730   */
14731  handlePostRender() {
14732    const t = this.frameState_, i = this.tileQueue_;
14733    if (!i.isEmpty()) {
14734      let n = this.maxTilesLoading_, r = n;
14735      if (t) {
14736        const o = t.viewHints;
14737        if (o[Xt.ANIMATING] || o[Xt.INTERACTING]) {
14738          const a = Date.now() - t.time > 8;
14739          n = a ? 0 : 8, r = a ? 0 : 2;
14740        }
14741      }
14742      i.getTilesLoading() < n && (i.reprioritize(), i.loadMoreTiles(n, r));
14743    }
14744    t && this.renderer_ && !t.animate && (this.renderComplete_ === !0 ? (this.hasListener(Vi.RENDERCOMPLETE) && this.renderer_.dispatchRenderEvent(
14745      Vi.RENDERCOMPLETE,
14746      t
14747    ), this.loaded_ === !1 && (this.loaded_ = !0, this.dispatchEvent(
14748      new Xs(Oi.LOADEND, this, t)
14749    ))) : this.loaded_ === !0 && (this.loaded_ = !1, this.dispatchEvent(
14750      new Xs(Oi.LOADSTART, this, t)
14751    )));
14752    const s = this.postRenderFunctions_;
14753    for (let n = 0, r = s.length; n < r; ++n)
14754      s[n](this, t);
14755    s.length = 0;
14756  }
14757  /**
14758   * @private
14759   */
14760  handleSizeChanged_() {
14761    this.getView() && !this.getView().getAnimating() && this.getView().resolveConstraints(0), this.render();
14762  }
14763  /**
14764   * @private
14765   */
14766  handleTargetChanged_() {
14767    if (this.mapBrowserEventHandler_) {
14768      for (let s = 0, n = this.targetChangeHandlerKeys_.length; s < n; ++s)
14769        Mt(this.targetChangeHandlerKeys_[s]);
14770      this.targetChangeHandlerKeys_ = null, this.viewport_.removeEventListener(
14771        et.CONTEXTMENU,
14772        this.boundHandleBrowserEvent_
14773      ), this.viewport_.removeEventListener(
14774        et.WHEEL,
14775        this.boundHandleBrowserEvent_
14776      ), this.mapBrowserEventHandler_.dispose(), this.mapBrowserEventHandler_ = null, Il(this.viewport_);
14777    }
14778    if (this.targetElement_) {
14779      this.resizeObserver_.unobserve(this.targetElement_);
14780      const s = this.targetElement_.getRootNode();
14781      s instanceof ShadowRoot && this.resizeObserver_.unobserve(s.host), this.setSize(void 0);
14782    }
14783    const t = this.getTarget(), i = typeof t == "string" ? document.getElementById(t) : t;
14784    if (this.targetElement_ = i, !i)
14785      this.renderer_ && (clearTimeout(this.postRenderTimeoutHandle_), this.postRenderTimeoutHandle_ = void 0, this.postRenderFunctions_.length = 0, this.renderer_.dispose(), this.renderer_ = null), this.animationDelayKey_ && (cancelAnimationFrame(this.animationDelayKey_), this.animationDelayKey_ = void 0);
14786    else {
14787      i.appendChild(this.viewport_), this.renderer_ || (this.renderer_ = new MM(this)), this.mapBrowserEventHandler_ = new SM(
14788        this,
14789        this.moveTolerance_
14790      );
14791      for (const r in dt)
14792        this.mapBrowserEventHandler_.addEventListener(
14793          dt[r],
14794          this.handleMapBrowserEvent.bind(this)
14795        );
14796      this.viewport_.addEventListener(
14797        et.CONTEXTMENU,
14798        this.boundHandleBrowserEvent_,
14799        !1
14800      ), this.viewport_.addEventListener(
14801        et.WHEEL,
14802        this.boundHandleBrowserEvent_,
14803        Vf ? { passive: !1 } : !1
14804      );
14805      const s = this.keyboardEventTarget_ ? this.keyboardEventTarget_ : i;
14806      this.targetChangeHandlerKeys_ = [
14807        lt(
14808          s,
14809          et.KEYDOWN,
14810          this.handleBrowserEvent,
14811          this
14812        ),
14813        lt(
14814          s,
14815          et.KEYPRESS,
14816          this.handleBrowserEvent,
14817          this
14818        )
14819      ];
14820      const n = i.getRootNode();
14821      n instanceof ShadowRoot && this.resizeObserver_.observe(n.host), this.resizeObserver_.observe(i);
14822    }
14823    this.updateSize();
14824  }
14825  /**
14826   * @private
14827   */
14828  handleTileChange_() {
14829    this.render();
14830  }
14831  /**
14832   * @private
14833   */
14834  handleViewPropertyChanged_() {
14835    this.render();
14836  }
14837  /**
14838   * @private
14839   */
14840  handleViewChanged_() {
14841    this.viewPropertyListenerKey_ && (Mt(this.viewPropertyListenerKey_), this.viewPropertyListenerKey_ = null), this.viewChangeListenerKey_ && (Mt(this.viewChangeListenerKey_), this.viewChangeListenerKey_ = null);
14842    const t = this.getView();
14843    t && (this.updateViewportSize_(), this.viewPropertyListenerKey_ = lt(
14844      t,
14845      En.PROPERTYCHANGE,
14846      this.handleViewPropertyChanged_,
14847      this
14848    ), this.viewChangeListenerKey_ = lt(
14849      t,
14850      et.CHANGE,
14851      this.handleViewPropertyChanged_,
14852      this
14853    ), t.resolveConstraints(0)), this.render();
14854  }
14855  /**
14856   * @private
14857   */
14858  handleLayerGroupChanged_() {
14859    this.layerGroupPropertyListenerKeys_ && (this.layerGroupPropertyListenerKeys_.forEach(Mt), this.layerGroupPropertyListenerKeys_ = null);
14860    const t = this.getLayerGroup();
14861    t && (this.handleLayerAdd_(new ki("addlayer", t)), this.layerGroupPropertyListenerKeys_ = [
14862      lt(t, En.PROPERTYCHANGE, this.render, this),
14863      lt(t, et.CHANGE, this.render, this),
14864      lt(t, "addlayer", this.handleLayerAdd_, this),
14865      lt(t, "removelayer", this.handleLayerRemove_, this)
14866    ]), this.render();
14867  }
14868  /**
14869   * @return {boolean} Is rendered.
14870   */
14871  isRendered() {
14872    return !!this.frameState_;
14873  }
14874  /**
14875   * @private
14876   */
14877  animationDelay_() {
14878    this.animationDelayKey_ = void 0, this.renderFrame_(Date.now());
14879  }
14880  /**
14881   * Requests an immediate render in a synchronous manner.
14882   * @api
14883   */
14884  renderSync() {
14885    this.animationDelayKey_ && cancelAnimationFrame(this.animationDelayKey_), this.animationDelay_();
14886  }
14887  /**
14888   * Redraws all text after new fonts have loaded
14889   */
14890  redrawText() {
14891    const t = this.getLayerGroup().getLayerStatesArray();
14892    for (let i = 0, s = t.length; i < s; ++i) {
14893      const n = t[i].layer;
14894      n.hasRenderer() && n.getRenderer().handleFontsChanged();
14895    }
14896  }
14897  /**
14898   * Request a map rendering (at the next animation frame).
14899   * @api
14900   */
14901  render() {
14902    this.renderer_ && this.animationDelayKey_ === void 0 && (this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_));
14903  }
14904  /**
14905   * Remove the given control from the map.
14906   * @param {import("./control/Control.js").default} control Control.
14907   * @return {import("./control/Control.js").default|undefined} The removed control (or undefined
14908   *     if the control was not found).
14909   * @api
14910   */
14911  removeControl(t) {
14912    return this.getControls().remove(t);
14913  }
14914  /**
14915   * Remove the given interaction from the map.
14916   * @param {import("./interaction/Interaction.js").default} interaction Interaction to remove.
14917   * @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or
14918   *     undefined if the interaction was not found).
14919   * @api
14920   */
14921  removeInteraction(t) {
14922    return this.getInteractions().remove(t);
14923  }
14924  /**
14925   * Removes the given layer from the map.
14926   * @param {import("./layer/Base.js").default} layer Layer.
14927   * @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the
14928   *     layer was not found).
14929   * @api
14930   */
14931  removeLayer(t) {
14932    return this.getLayerGroup().getLayers().remove(t);
14933  }
14934  /**
14935   * @param {import("./layer/Group.js").GroupEvent} event The layer remove event.
14936   * @private
14937   */
14938  handleLayerRemove_(t) {
14939    Mg(t.layer);
14940  }
14941  /**
14942   * Remove the given overlay from the map.
14943   * @param {import("./Overlay.js").default} overlay Overlay.
14944   * @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined
14945   *     if the overlay was not found).
14946   * @api
14947   */
14948  removeOverlay(t) {
14949    return this.getOverlays().remove(t);
14950  }
14951  /**
14952   * @param {number} time Time.
14953   * @private
14954   */
14955  renderFrame_(t) {
14956    const i = this.getSize(), s = this.getView(), n = this.frameState_;
14957    let r = null;
14958    if (i !== void 0 && ku(i) && s && s.isDef()) {
14959      const o = s.getHints(
14960        this.frameState_ ? this.frameState_.viewHints : void 0
14961      ), a = s.getState();
14962      if (r = {
14963        animate: !1,
14964        coordinateToPixelTransform: this.coordinateToPixelTransform_,
14965        declutterTree: null,
14966        extent: on(
14967          a.center,
14968          a.resolution,
14969          a.rotation,
14970          i
14971        ),
14972        index: this.frameIndex_++,
14973        layerIndex: 0,
14974        layerStatesArray: this.getLayerGroup().getLayerStatesArray(),
14975        pixelRatio: this.pixelRatio_,
14976        pixelToCoordinateTransform: this.pixelToCoordinateTransform_,
14977        postRenderFunctions: [],
14978        size: i,
14979        tileQueue: this.tileQueue_,
14980        time: t,
14981        usedTiles: {},
14982        viewState: a,
14983        viewHints: o,
14984        wantedTiles: {},
14985        mapId: ot(this),
14986        renderTargets: {}
14987      }, a.nextCenter && a.nextResolution) {
14988        const l = isNaN(a.nextRotation) ? a.rotation : a.nextRotation;
14989        r.nextExtent = on(
14990          a.nextCenter,
14991          a.nextResolution,
14992          l,
14993          i
14994        );
14995      }
14996    }
14997    this.frameState_ = r, this.renderer_.renderFrame(r), r && (r.animate && this.render(), Array.prototype.push.apply(
14998      this.postRenderFunctions_,
14999      r.postRenderFunctions
15000    ), n && (!this.previousExtent_ || !Is(this.previousExtent_) && !pn(r.extent, this.previousExtent_)) && (this.dispatchEvent(
15001      new Xs(Oi.MOVESTART, this, n)
15002    ), this.previousExtent_ = Tn(this.previousExtent_)), this.previousExtent_ && !r.viewHints[Xt.AN
15002IMATING] && !r.viewHints[Xt.INTERACTING] && !pn(r.extent, this.previousExtent_) && (this.dispatchEvent(
15003      new Xs(Oi.MOVEEND, this, r)
15004    ), Gd(r.extent, this.previousExtent_))), this.dispatchEvent(new Xs(Oi.POSTRENDER, this, r)), this.renderComplete_ = this.hasListener(Oi.LOADSTART) || this.hasListener(Oi.LOADEND) || this.hasListener(Vi.RENDERCOMPLETE) ? !this.tileQueue_.getTilesLoading() && !this.tileQueue_.getCount() && !this.getLoadingOrNotReady() : void 0, this.postRenderTimeoutHandle_ || (this.postRenderTimeoutHandle_ = setTimeout(() => {
15005      this.postRenderTimeoutHandle_ = void 0, this.handlePostRender();
15006    }, 0));
15007  }
15008  /**
15009   * Sets the layergroup of this map.
15010   * @param {LayerGroup} layerGroup A layer group containing the layers in this map.
15011   * @observable
15012   * @api
15013   */
15014  setLayerGroup(t) {
15015    const i = this.getLayerGroup();
15016    i && this.handleLayerRemove_(new ki("removelayer", i)), this.set(Qt.LAYERGROUP, t);
15017  }
15018  /**
15019   * Set the size of this map.
15020   * @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM.
15021   * @observable
15022   * @api
15023   */
15024  setSize(t) {
15025    this.set(Qt.SIZE, t);
15026  }
15027  /**
15028   * Set the target element to render this map into.
15029   * @param {HTMLElement|string} [target] The Element or id of the Element
15030   *     that the map is rendered in.
15031   * @observable
15032   * @api
15033   */
15034  setTarget(t) {
15035    this.set(Qt.TARGET, t);
15036  }
15037  /**
15038   * Set the view for this map.
15039   * @param {View|Promise<import("./View.js").ViewOptions>} view The view that controls this map.
15040   * It is also possible to pass a promise that resolves to options for constructing a view.  This
15041   * alternative allows view properties to be resolved by sources or other components that load
15042   * view-related metadata.
15043   * @observable
15044   * @api
15045   */
15046  setView(t) {
15047    if (!t || t instanceof qe) {
15048      this.set(Qt.VIEW, t);
15049      return;
15050    }
15051    this.set(Qt.VIEW, new qe());
15052    const i = this;
15053    t.then(function(s) {
15054      i.setView(new qe(s));
15055    });
15056  }
15057  /**
15058   * Force a recalculation of the map viewport size.  This should be called when
15059   * third-party code changes the size of the map viewport.
15060   * @api
15061   */
15062  updateSize() {
15063    const t = this.getTargetElement();
15064    let i;
15065    if (t) {
15066      const n = getComputedStyle(t), r = t.offsetWidth - parseFloat(n.borderLeftWidth) - parseFloat(n.paddingLeft) - parseFloat(n.paddingRight) - parseFloat(n.borderRightWidth), o = t.offsetHeight - parseFloat(n.borderTopWidth) - parseFloat(n.paddingTop) - parseFloat(n.paddingBottom) - parseFloat(n.borderBottomWidth);
15067      !isNaN(r) && !isNaN(o) && (i = [r, o], !ku(i) && (t.offsetWidth || t.offsetHeight || t.getClientRects().length) && Kd(
15068        "No map visible because the map container's width or height are 0."
15069      ));
15070    }
15071    const s = this.getSize();
15072    i && (!s || !wi(i, s)) && (this.setSize(i), this.updateViewportSize_());
15073  }
15074  /**
15075   * Recomputes the viewport size and save it on the view object (if any)
15076   * @private
15077   */
15078  updateViewportSize_() {
15079    const t = this.getView();
15080    if (t) {
15081      let i;
15082      const s = getComputedStyle(this.viewport_);
15083      s.width && s.height && (i = [
15084        parseInt(s.width, 10),
15085        parseInt(s.height, 10)
15086      ]), t.setViewportSize(i);
15087    }
15088  }
15089};
15090function xC(e) {
15091  let t = null;
15092  e.keyboardEventTarget !== void 0 && (t = typeof e.keyboardEventTarget == "string" ? document.getElementById(e.keyboardEventTarget) : e.keyboardEventTarget);
15093  const i = {}, s = e.layers && typeof /** @type {?} */
15094  e.layers.getLayers == "function" ? (
15095    /** @type {LayerGroup} */
15096    e.layers
15097  ) : new ya({
15098    layers: (
15099      /** @type {Collection<import("./layer/Base.js").default>|Array<import("./layer/Base.js").default>} */
15100      e.layers
15101    )
15102  });
15103  i[Qt.LAYERGROUP] = s, i[Qt.TARGET] = e.target, i[Qt.VIEW] = e.view instanceof qe ? e.view : new qe();
15104  let n;
15105  e.controls !== void 0 && (Array.isArray(e.controls) ? n = new Pe(e.controls.slice()) : (at(
15106    typeof /** @type {?} */
15107    e.controls.getArray == "function",
15108    47
15109  ), n = e.controls));
15110  let r;
15111  e.interactions !== void 0 && (Array.isArray(e.interactions) ? r = new Pe(e.interactions.slice()) : (at(
15112    typeof /** @type {?} */
15113    e.interactions.getArray == "function",
15114    48
15115  ), r = e.interactions));
15116  let o;
15117  return e.overlays !== void 0 ? Array.isArray(e.overlays) ? o = new Pe(e.overlays.slice()) : (at(
15118    typeof /** @type {?} */
15119    e.overlays.getArray == "function",
15120    49
15121  ), o = e.overlays) : o = new Pe(), {
15122    controls: n,
15123    interactions: r,
15124    keyboardEventTarget: t,
15125    overlays: o,
15126    values: i
15127  };
15128}
15129const vC = yC;
15130class Yh extends ni {
15131  /**
15132   * @param {Geometry|ObjectWithGeometry<Geometry>} [geometryOrProperties]
15133   *     You may pass a Geometry object directly, or an object literal containing
15134   *     properties. If you pass an object literal, you may include a Geometry
15135   *     associated with a `geometry` key.
15136   */
15137  constructor(t) {
15138    if (super(), this.on, this.once, this.un, this.id_ = void 0, this.geometryName_ = "geometry", this.style_ = null, this.styleFunction_ = void 0, this.geometryChangeKey_ = null, this.addChangeListener(this.geometryName_, this.handleGeometryChanged_), t)
15139      if (typeof /** @type {?} */
15140      t.getSimplifiedGeometry == "function") {
15141        const i = (
15142          /** @type {Geometry} */
15143          t
15144        );
15145        this.setGeometry(i);
15146      } else {
15147        const i = t;
15148        this.setProperties(i);
15149      }
15150  }
15151  /**
15152   * Clone this feature. If the original feature has a geometry it
15153   * is also cloned. The feature id is not set in the clone.
15154   * @return {Feature<Geometry>} The clone.
15155   * @api
15156   */
15157  clone() {
15158    const t = (
15159      /** @type {Feature<Geometry>} */
15160      new Yh(this.hasProperties() ? this.getProperties() : null)
15161    );
15162    t.setGeometryName(this.getGeometryName());
15163    const i = this.getGeometry();
15164    i && t.setGeometry(
15165      /** @type {Geometry} */
15166      i.clone()
15167    );
15168    const s = this.getStyle();
15169    return s && t.setStyle(s), t;
15170  }
15171  /**
15172   * Get the feature's default geometry.  A feature may have any number of named
15173   * geometries.  The "default" geometry (the one that is rendered by default) is
15174   * set when calling {@link module:ol/Feature~Feature#setGeometry}.
15175   * @return {Geometry|undefined} The default geometry for the feature.
15176   * @api
15177   * @observable
15178   */
15179  getGeometry() {
15180    return (
15181      /** @type {Geometry|undefined} */
15182      this.get(this.geometryName_)
15183    );
15184  }
15185  /**
15186   * Get the feature identifier.  This is a stable identifier for the feature and
15187   * is either set when reading data from a remote source or set explicitly by
15188   * calling {@link module:ol/Feature~Feature#setId}.
15189   * @return {number|string|undefined} Id.
15190   * @api
15191   */
15192  getId() {
15193    return this.id_;
15194  }
15195  /**
15196   * Get the name of the feature's default geometry.  By default, the default
15197   * geometry is named `geometry`.
15198   * @return {string} Get the property name associated with the default geometry
15199   *     for this feature.
15200   * @api
15201   */
15202  getGeometryName() {
15203    return this.geometryName_;
15204  }
15205  /**
15206   * Get the feature's style. Will return what was provided to the
15207   * {@link module:ol/Feature~Feature#setStyle} method.
15208   * @return {import("./style/Style.js").StyleLike|undefined} The feature style.
15209   * @api
15210   */
15211  getStyle() {
15212    return this.style_;
15213  }
15214  /**
15215   * Get the feature's style function.
15216   * @return {import("./style/Style.js").StyleFunction|undefined} Return a function
15217   * representing the current style of this feature.
15218   * @api
15219   */
15220  getStyleFunction() {
15221    return this.styleFunction_;
15222  }
15223  /**
15224   * @private
15225   */
15226  handleGeometryChange_() {
15227    this.changed();
15228  }
15229  /**
15230   * @private
15231   */
15232  handleGeometryChanged_() {
15233    this.geometryChangeKey_ && (Mt(this.geometryChangeKey_), this.geometryChangeKey_ = null);
15234    const t = this.getGeometry();
15235    t && (this.geometryChangeKey_ = lt(
15236      t,
15237      et.CHANGE,
15238      this.handleGeometryChange_,
15239      this
15240    )), this.changed();
15241  }
15242  /**
15243   * Set the default geometry for the feature.  This will update the property
15244   * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
15245   * @param {Geometry|undefined} geometry The new geometry.
15246   * @api
15247   * @observable
15248   */
15249  setGeometry(t) {
15250    this.set(this.geometryName_, t);
15251  }
15252  /**
15253   * Set the style for the feature to override the layer style.  This can be a
15254   * single style object, an array of styles, or a function that takes a
15255   * resolution and returns an array of styles. To unset the feature style, call
15256   * `setStyle()` without arguments or a falsey value.
15257   * @param {import("./style/Style.js").StyleLike} [style] Style for this feature.
15258   * @api
15259   * @fires module:ol/events/Event~BaseEvent#event:change
15260   */
15261  setStyle(t) {
15262    this.style_ = t, this.styleFunction_ = t ? EC(t) : void 0, this.changed();
15263  }
15264  /**
15265   * Set the feature id.  The feature id is considered stable and may be used when
15266   * requesting features or comparing identifiers returned from a remote source.
15267   * The feature id can be used with the
15268   * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.
15269   * @param {number|string|undefined} id The feature id.
15270   * @api
15271   * @fires module:ol/events/Event~BaseEvent#event:change
15272   */
15273  setId(t) {
15274    this.id_ = t, this.changed();
15275  }
15276  /**
15277   * Set the property name to be used when getting the feature's default geometry.
15278   * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
15279   * this name will be returned.
15280   * @param {string} name The property name of the default geometry.
15281   * @api
15282   */
15283  setGeometryName(t) {
15284    this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_), this.geometryName_ = t, this.addChangeListener(this.geometryName_, this.handleGeometryChanged_), this.handleGeometryChanged_();
15285  }
15286}
15287function EC(e) {
15288  if (typeof e == "function")
15289    return e;
15290  let t;
15291  return Array.isArray(e) ? t = e : (at(typeof /** @type {?} */
15292  e.getZIndex == "function", 41), t = [
15293    /** @type {import("./style/Style.js").default} */
15294    e
15295  ]), function() {
15296    return t;
15297  };
15298}
15299const Di = Yh;
15300class Kh {
15301  /**
15302   * @param {Options} [options] Options.
15303   */
15304  constructor(t) {
15305    t = t || {}, this.color_ = t.color !== void 0 ? t.color : null;
15306  }
15307  /**
15308   * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
15309   * @return {Fill} The cloned style.
15310   * @api
15311   */
15312  clone() {
15313    const t = this.getColor();
15314    return new Kh({
15315      color: Array.isArray(t) ? t.slice() : t || void 0
15316    });
15317  }
15318  /**
15319   * Get the fill color.
15320   * @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color.
15321   * @api
15322   */
15323  getColor() {
15324    return this.color_;
15325  }
15326  /**
15327   * Set the color.
15328   *
15329   * @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color.
15330   * @api
15331   */
15332  setColor(t) {
15333    this.color_ = t;
15334  }
15335}
15336const Mi = Kh;
15337function bg(e, t, i, s, n, r, o) {
15338  let a, l;
15339  const h = (i - t) / s;
15340  if (h === 1)
15341    a = t;
15342  else if (h === 2)
15343    a = t, l = n;
15344  else if (h !== 0) {
15345    let c = e[t], u = e[t + 1], d = 0;
15346    const f = [0];
15347    for (let m = t + s; m < i; m += s) {
15348      const p = e[m], y = e[m + 1];
15349      d += Math.sqrt((p - c) * (p - c) + (y - u) * (y - u)), f.push(d), c = p, u = y;
15350    }
15351    const g = n * d, _ = sE(f, g);
15352    _ < 0 ? (l = (g - f[-_ - 2]) / (f[-_ - 1] - f[-_ - 2]), a = t + (-_ - 2) * s) : a = t + _ * s;
15353  }
15354  o = o > 1 ? o : 2, r = r || new Array(o);
15355  for (let c = 0; c < o; ++c)
15356    r[c] = a === void 0 ? NaN : l === void 0 ? e[a + c] : Se(e[a + c], e[a + s + c], l);
15357  return r;
15358}
15359function kl(e, t, i, s, n, r) {
15360  if (i == t)
15361    return null;
15362  let o;
15363  if (n < e[t + s - 1])
15364    return r ? (o = e.slice(t, t + s), o[s - 1] = n, o) : null;
15365  if (e[i - 1] < n)
15366    return r ? (o = e.slice(i - s, i), o[s - 1] = n, o) : null;
15367  if (n == e[t + s - 1])
15368    return e.slice(t, t + s);
15369  let a = t / s, l = i / s;
15370  for (; a < l; ) {
15371    const d = a + l >> 1;
15372    n < e[(d + 1) * s - 1] ? l = d : a = d + 1;
15373  }
15374  const h = e[a * s - 1];
15375  if (n == h)
15376    return e.slice((a - 1) * s, (a - 1) * s + s);
15377  const c = e[(a + 1) * s - 1], u = (n - h) / (c - h);
15378  o = [];
15379  for (let d = 0; d < s - 1; ++d)
15380    o.push(
15381      Se(
15382        e[(a - 1) * s + d],
15383        e[a * s + d],
15384        u
15385      )
15386    );
15387  return o.push(n), o;
15388}
15389function MC(e, t, i, s, n, r, o) {
15390  if (o)
15391    return kl(
15392      e,
15393      t,
15394      i[i.length - 1],
15395      s,
15396      n,
15397      r
15398    );
15399  let a;
15400  if (n < e[s - 1])
15401    return r ? (a = e.slice(0, s), a[s - 1] = n, a) : null;
15402  if (e[e.length - 1] < n)
15403    return r ? (a = e.slice(e.length - s), a[s - 1] = n, a) : null;
15404  for (let l = 0, h = i.length; l < h; ++l) {
15405    const c = i[l];
15406    if (t != c) {
15407      if (n < e[t + s - 1])
15408        return null;
15409      if (n <= e[c - 1])
15410        return kl(
15411          e,
15412          t,
15413          c,
15414          s,
15415          n,
15416          !1
15417        );
15418      t = c;
15419    }
15420  }
15421  return null;
15422}
15423function wg(e, t, i, s) {
15424  let n = e[t], r = e[t + 1], o = 0;
15425  for (let a = t + s; a < i; a += s) {
15426    const l = e[a], h = e[a + 1];
15427    o += Math.sqrt((l - n) * (l - n) + (h - r) * (h - r)), n = l, r = h;
15428  }
15429  return o;
15430}
15431class Wo extends es {
15432  /**
15433   * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
15434   *     For internal use, flat coordinates in combination with `layout` are also accepted.
15435   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
15436   */
15437  constructor(t, i) {
15438    super(), this.flatMidpoint_ = null, this.flatMidpointRevision_ = -1, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, i !== void 0 && !Array.isArray(t[0]) ? this.setFlatCoordinates(
15439      i,
15440      /** @type {Array<number>} */
15441      t
15442    ) : this.setCoordinates(
15443      /** @type {Array<import("../coordinate.js").Coordinate>} */
15444      t,
15445      i
15446    );
15447  }
15448  /**
15449   * Append the passed coordinate to the coordinates of the linestring.
15450   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
15451   * @api
15452   */
15453  appendCoordinate(t) {
15454    this.flatCoordinates ? pi(this.flatCoordinates, t) : this.flatCoordinates = t.slice(), this.changed();
15455  }
15456  /**
15457   * Make a complete copy of the geometry.
15458   * @return {!LineString} Clone.
15459   * @api
15460   */
15461  clone() {
15462    const t = new Wo(
15463      this.flatCoordinates.slice(),
15464      this.layout
15465    );
15466    return t.applyProperties(this), t;
15467  }
15468  /**
15469   * @param {number} x X.
15470   * @param {number} y Y.
15471   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
15472   * @param {number} minSquaredDistance Minimum squared distance.
15473   * @return {number} Minimum squared distance.
15474   */
15475  closestPointXY(t, i, s, n) {
15476    return n < Ts(this.getExtent(), t, i) ? n : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
15477      Ah(
15478        this.flatCoordinates,
15479        0,
15480        this.flatCoordinates.length,
15481        this.stride,
15482        0
15483      )
15484    ), this.maxDeltaRevision_ = this.getRevision()), Oh(
15485      this.flatCoordinates,
15486      0,
15487      this.flatCoordinates.length,
15488      this.stride,
15489      this.maxDelta_,
15490      !1,
15491      t,
15492      i,
15493      s,
15494      n
15495    ));
15496  }
15497  /**
15498   * Iterate over each segment, calling the provided callback.
15499   * If the callback returns a truthy value the function returns that
15500   * value immediately. Otherwise the function returns `false`.
15501   *
15502   * @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function
15503   *     called for each segment. The function will receive two arguments, the start and end coordinates of the segment.
15504   * @return {T|boolean} Value.
15505   * @template T,S
15506   * @api
15507   */
15508  forEachSegment(t) {
15509    return og(
15510      this.flatCoordinates,
15511      0,
15512      this.flatCoordinates.length,
15513      this.stride,
15514      t
15515    );
15516  }
15517  /**
15518   * Returns the coordinate at `m` using linear interpolation, or `null` if no
15519   * such coordinate exists.
15520   *
15521   * `extrapolate` controls extrapolation beyond the range of Ms in the
15522   * MultiLineString. If `extrapolate` is `true` then Ms less than the first
15523   * M will return the first coordinate and Ms greater than the last M will
15524   * return the last coordinate.
15525   *
15526   * @param {number} m M.
15527   * @param {boolean} [extrapolate] Extrapolate. Default is `false`.
15528   * @return {import("../coordinate.js").Coordinate|null} Coordinate.
15529   * @api
15530   */
15531  getCoordinateAtM(t, i) {
15532    return this.layout != "XYM" && this.layout != "XYZM" ? null : (i = i !== void 0 ? i : !1, kl(
15533      this.flatCoordinates,
15534      0,
15535      this.flatCoordinates.length,
15536      this.stride,
15537      t,
15538      i
15539    ));
15540  }
15541  /**
15542   * Return the coordinates of the linestring.
15543   * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
15544   * @api
15545   */
15546  getCoordinates() {
15547    return ji(
15548      this.flatCoordinates,
15549      0,
15550      this.flatCoordinates.length,
15551      this.stride
15552    );
15553  }
15554  /**
15555   * Return the coordinate at the provided fraction along the linestring.
15556   * The `fraction` is a number between 0 and 1, where 0 is the start of the
15557   * linestring and 1 is the end.
15558   * @param {number} fraction Fraction.
15559   * @param {import("../coordinate.js").Coordinate} [dest] Optional coordinate whose values will
15560   *     be modified. If not provided, a new coordinate will be returned.
15561   * @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point.
15562   * @api
15563   */
15564  getCoordinateAt(t, i) {
15565    return bg(
15566      this.flatCoordinates,
15567      0,
15568      this.flatCoordinates.length,
15569      this.stride,
15570      t,
15571      i,
15572      this.stride
15573    );
15574  }
15575  /**
15576   * Return the length of the linestring on projected plane.
15577   * @return {number} Length (on projected plane).
15578   * @api
15579   */
15580  getLength() {
15581    return wg(
15582      this.flatCoordinates,
15583      0,
15584      this.flatCoordinates.length,
15585      this.stride
15586    );
15587  }
15588  /**
15589   * @return {Array<number>} Flat midpoint.
15590   */
15591  getFlatMidpoint() {
15592    return this.flatMidpointRevision_ != this.getRevision() && (this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_), this.flatMidpointRevision_ = this.getRevision()), this.flatMidpoint_;
15593  }
15594  /**
15595   * @param {number} squaredTolerance Squared tolerance.
15596   * @return {LineString} Simplified LineString.
15597   * @protected
15598   */
15599  getSimplifiedGeometryInternal(t) {
15600    const i = [];
15601    return i.length = Dh(
15602      this.flatCoordinates,
15603      0,
15604      this.flatCoordinates.length,
15605      this.stride,
15606      t,
15607      i,
15608      0
15609    ), new Wo(i, "XY");
15610  }
15611  /**
15612   * Get the type of this geometry.
15613   * @return {import("./Geometry.js").Type} Geometry type.
15614   * @api
15615   */
15616  getType() {
15617    return "LineString";
15618  }
15619  /**
15620   * Test if the geometry and the passed extent intersect.
15621   * @param {import("../extent.js").Extent} extent Extent.
15622   * @return {boolean} `true` if the geometry and the extent intersect.
15623   * @api
15624   */
15625  intersectsExtent(t) {
15626    return _a(
15627      this.flatCoordinates,
15628      0,
15629      this.flatCoordinates.length,
15630      this.stride,
15631      t
15632    );
15633  }
15634  /**
15635   * Set the coordinates of the linestring.
15636   * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
15637   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
15638   * @api
15639   */
15640  setCoordinates(t, i) {
15641    this.setLayout(i, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = ga(
15642      this.flatCoordinates,
15643      0,
15644      t,
15645      this.stride
15646    ), this.changed();
15647  }
15648}
15649const ys = Wo;
15650class qh {
15651  /**
15652   * @param {Options} [options] Options.
15653   */
15654  constructor(t) {
15655    t = t || {}, this.color_ = t.color !== void 0 ? t.color : null, this.lineCap_ = t.lineCap, this.lineDash_ = t.lineDash !== void 0 ? t.lineDash : null, this.lineDashOffset_ = t.lineDashOffset, this.lineJoin_ = t.lineJoin, this.miterLimit_ = t.miter
15655Limit, this.width_ = t.width;
15656  }
15657  /**
15658   * Clones the style.
15659   * @return {Stroke} The cloned style.
15660   * @api
15661   */
15662  clone() {
15663    const t = this.getColor();
15664    return new qh({
15665      color: Array.isArray(t) ? t.slice() : t || void 0,
15666      lineCap: this.getLineCap(),
15667      lineDash: this.getLineDash() ? this.getLineDash().slice() : void 0,
15668      lineDashOffset: this.getLineDashOffset(),
15669      lineJoin: this.getLineJoin(),
15670      miterLimit: this.getMiterLimit(),
15671      width: this.getWidth()
15672    });
15673  }
15674  /**
15675   * Get the stroke color.
15676   * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
15677   * @api
15678   */
15679  getColor() {
15680    return this.color_;
15681  }
15682  /**
15683   * Get the line cap type for the stroke.
15684   * @return {CanvasLineCap|undefined} Line cap.
15685   * @api
15686   */
15687  getLineCap() {
15688    return this.lineCap_;
15689  }
15690  /**
15691   * Get the line dash style for the stroke.
15692   * @return {Array<number>|null} Line dash.
15693   * @api
15694   */
15695  getLineDash() {
15696    return this.lineDash_;
15697  }
15698  /**
15699   * Get the line dash offset for the stroke.
15700   * @return {number|undefined} Line dash offset.
15701   * @api
15702   */
15703  getLineDashOffset() {
15704    return this.lineDashOffset_;
15705  }
15706  /**
15707   * Get the line join type for the stroke.
15708   * @return {CanvasLineJoin|undefined} Line join.
15709   * @api
15710   */
15711  getLineJoin() {
15712    return this.lineJoin_;
15713  }
15714  /**
15715   * Get the miter limit for the stroke.
15716   * @return {number|undefined} Miter limit.
15717   * @api
15718   */
15719  getMiterLimit() {
15720    return this.miterLimit_;
15721  }
15722  /**
15723   * Get the stroke width.
15724   * @return {number|undefined} Width.
15725   * @api
15726   */
15727  getWidth() {
15728    return this.width_;
15729  }
15730  /**
15731   * Set the color.
15732   *
15733   * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
15734   * @api
15735   */
15736  setColor(t) {
15737    this.color_ = t;
15738  }
15739  /**
15740   * Set the line cap.
15741   *
15742   * @param {CanvasLineCap|undefined} lineCap Line cap.
15743   * @api
15744   */
15745  setLineCap(t) {
15746    this.lineCap_ = t;
15747  }
15748  /**
15749   * Set the line dash.
15750   *
15751   * @param {Array<number>|null} lineDash Line dash.
15752   * @api
15753   */
15754  setLineDash(t) {
15755    this.lineDash_ = t;
15756  }
15757  /**
15758   * Set the line dash offset.
15759   *
15760   * @param {number|undefined} lineDashOffset Line dash offset.
15761   * @api
15762   */
15763  setLineDashOffset(t) {
15764    this.lineDashOffset_ = t;
15765  }
15766  /**
15767   * Set the line join.
15768   *
15769   * @param {CanvasLineJoin|undefined} lineJoin Line join.
15770   * @api
15771   */
15772  setLineJoin(t) {
15773    this.lineJoin_ = t;
15774  }
15775  /**
15776   * Set the miter limit.
15777   *
15778   * @param {number|undefined} miterLimit Miter limit.
15779   * @api
15780   */
15781  setMiterLimit(t) {
15782    this.miterLimit_ = t;
15783  }
15784  /**
15785   * Set the width.
15786   *
15787   * @param {number|undefined} width Width.
15788   * @api
15789   */
15790  setWidth(t) {
15791    this.width_ = t;
15792  }
15793}
15794const vi = qh, rt = {
15795  IDLE: 0,
15796  LOADING: 1,
15797  LOADED: 2,
15798  ERROR: 3,
15799  EMPTY: 4
15800};
15801class Vh {
15802  /**
15803   * @param {Options} options Options.
15804   */
15805  constructor(t) {
15806    this.opacity_ = t.opacity, this.rotateWithView_ = t.rotateWithView, this.rotation_ = t.rotation, this.scale_ = t.scale, this.scaleArray_ = ye(t.scale), this.displacement_ = t.displacement, this.declutterMode_ = t.declutterMode;
15807  }
15808  /**
15809   * Clones the style.
15810   * @return {ImageStyle} The cloned style.
15811   * @api
15812   */
15813  clone() {
15814    const t = this.getScale();
15815    return new Vh({
15816      opacity: this.getOpacity(),
15817      scale: Array.isArray(t) ? t.slice() : t,
15818      rotation: this.getRotation(),
15819      rotateWithView: this.getRotateWithView(),
15820      displacement: this.getDisplacement().slice(),
15821      declutterMode: this.getDeclutterMode()
15822    });
15823  }
15824  /**
15825   * Get the symbolizer opacity.
15826   * @return {number} Opacity.
15827   * @api
15828   */
15829  getOpacity() {
15830    return this.opacity_;
15831  }
15832  /**
15833   * Determine whether the symbolizer rotates with the map.
15834   * @return {boolean} Rotate with map.
15835   * @api
15836   */
15837  getRotateWithView() {
15838    return this.rotateWithView_;
15839  }
15840  /**
15841   * Get the symoblizer rotation.
15842   * @return {number} Rotation.
15843   * @api
15844   */
15845  getRotation() {
15846    return this.rotation_;
15847  }
15848  /**
15849   * Get the symbolizer scale.
15850   * @return {number|import("../size.js").Size} Scale.
15851   * @api
15852   */
15853  getScale() {
15854    return this.scale_;
15855  }
15856  /**
15857   * Get the symbolizer scale array.
15858   * @return {import("../size.js").Size} Scale array.
15859   */
15860  getScaleArray() {
15861    return this.scaleArray_;
15862  }
15863  /**
15864   * Get the displacement of the shape
15865   * @return {Array<number>} Shape's center displacement
15866   * @api
15867   */
15868  getDisplacement() {
15869    return this.displacement_;
15870  }
15871  /**
15872   * Get the declutter mode of the shape
15873   * @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode
15874   * @api
15875   */
15876  getDeclutterMode() {
15877    return this.declutterMode_;
15878  }
15879  /**
15880   * Get the anchor point in pixels. The anchor determines the center point for the
15881   * symbolizer.
15882   * @abstract
15883   * @return {Array<number>} Anchor.
15884   */
15885  getAnchor() {
15886    return Z();
15887  }
15888  /**
15889   * Get the image element for the symbolizer.
15890   * @abstract
15891   * @param {number} pixelRatio Pixel ratio.
15892   * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
15893   */
15894  getImage(t) {
15895    return Z();
15896  }
15897  /**
15898   * @abstract
15899   * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
15900   */
15901  getHitDetectionImage() {
15902    return Z();
15903  }
15904  /**
15905   * Get the image pixel ratio.
15906   * @param {number} pixelRatio Pixel ratio.
15907   * @return {number} Pixel ratio.
15908   */
15909  getPixelRatio(t) {
15910    return 1;
15911  }
15912  /**
15913   * @abstract
15914   * @return {import("../ImageState.js").default} Image state.
15915   */
15916  getImageState() {
15917    return Z();
15918  }
15919  /**
15920   * @abstract
15921   * @return {import("../size.js").Size} Image size.
15922   */
15923  getImageSize() {
15924    return Z();
15925  }
15926  /**
15927   * Get the origin of the symbolizer.
15928   * @abstract
15929   * @return {Array<number>} Origin.
15930   */
15931  getOrigin() {
15932    return Z();
15933  }
15934  /**
15935   * Get the size of the symbolizer (in pixels).
15936   * @abstract
15937   * @return {import("../size.js").Size} Size.
15938   */
15939  getSize() {
15940    return Z();
15941  }
15942  /**
15943   * Set the displacement.
15944   *
15945   * @param {Array<number>} displacement Displacement.
15946   * @api
15947   */
15948  setDisplacement(t) {
15949    this.displacement_ = t;
15950  }
15951  /**
15952   * Set the opacity.
15953   *
15954   * @param {number} opacity Opacity.
15955   * @api
15956   */
15957  setOpacity(t) {
15958    this.opacity_ = t;
15959  }
15960  /**
15961   * Set whether to rotate the style with the view.
15962   *
15963   * @param {boolean} rotateWithView Rotate with map.
15964   * @api
15965   */
15966  setRotateWithView(t) {
15967    this.rotateWithView_ = t;
15968  }
15969  /**
15970   * Set the rotation.
15971   *
15972   * @param {number} rotation Rotation.
15973   * @api
15974   */
15975  setRotation(t) {
15976    this.rotation_ = t;
15977  }
15978  /**
15979   * Set the scale.
15980   *
15981   * @param {number|import("../size.js").Size} scale Scale.
15982   * @api
15983   */
15984  setScale(t) {
15985    this.scale_ = t, this.scaleArray_ = ye(t);
15986  }
15987  /**
15988   * @abstract
15989   * @param {function(import("../events/Event.js").default): void} listener Listener function.
15990   */
15991  listenImageChange(t) {
15992    Z();
15993  }
15994  /**
15995   * Load not yet loaded URI.
15996   * @abstract
15997   */
15998  load() {
15999    Z();
16000  }
16001  /**
16002   * @abstract
16003   * @param {function(import("../events/Event.js").default): void} listener Listener function.
16004   */
16005  unlistenImageChange(t) {
16006    Z();
16007  }
16008}
16009const Sg = Vh;
16010function Ze(e) {
16011  return Array.isArray(e) ? Zf(e) : e;
16012}
16013class Hh extends Sg {
16014  /**
16015   * @param {Options} options Options.
16016   */
16017  constructor(t) {
16018    const i = t.rotateWithView !== void 0 ? t.rotateWithView : !1;
16019    super({
16020      opacity: 1,
16021      rotateWithView: i,
16022      rotation: t.rotation !== void 0 ? t.rotation : 0,
16023      scale: t.scale !== void 0 ? t.scale : 1,
16024      displacement: t.displacement !== void 0 ? t.displacement : [0, 0],
16025      declutterMode: t.declutterMode
16026    }), this.canvas_ = void 0, this.hitDetectionCanvas_ = null, this.fill_ = t.fill !== void 0 ? t.fill : null, this.origin_ = [0, 0], this.points_ = t.points, this.radius_ = t.radius !== void 0 ? t.radius : t.radius1, this.radius2_ = t.radius2, this.angle_ = t.angle !== void 0 ? t.angle : 0, this.stroke_ = t.stroke !== void 0 ? t.stroke : null, this.size_ = null, this.renderOptions_ = null, this.render();
16027  }
16028  /**
16029   * Clones the style.
16030   * @return {RegularShape} The cloned style.
16031   * @api
16032   */
16033  clone() {
16034    const t = this.getScale(), i = new Hh({
16035      fill: this.getFill() ? this.getFill().clone() : void 0,
16036      points: this.getPoints(),
16037      radius: this.getRadius(),
16038      radius2: this.getRadius2(),
16039      angle: this.getAngle(),
16040      stroke: this.getStroke() ? this.getStroke().clone() : void 0,
16041      rotation: this.getRotation(),
16042      rotateWithView: this.getRotateWithView(),
16043      scale: Array.isArray(t) ? t.slice() : t,
16044      displacement: this.getDisplacement().slice(),
16045      declutterMode: this.getDeclutterMode()
16046    });
16047    return i.setOpacity(this.getOpacity()), i;
16048  }
16049  /**
16050   * Get the anchor point in pixels. The anchor determines the center point for the
16051   * symbolizer.
16052   * @return {Array<number>} Anchor.
16053   * @api
16054   */
16055  getAnchor() {
16056    const t = this.size_;
16057    if (!t)
16058      return null;
16059    const i = this.getDisplacement(), s = this.getScaleArray();
16060    return [
16061      t[0] / 2 - i[0] / s[0],
16062      t[1] / 2 + i[1] / s[1]
16063    ];
16064  }
16065  /**
16066   * Get the angle used in generating the shape.
16067   * @return {number} Shape's rotation in radians.
16068   * @api
16069   */
16070  getAngle() {
16071    return this.angle_;
16072  }
16073  /**
16074   * Get the fill style for the shape.
16075   * @return {import("./Fill.js").default} Fill style.
16076   * @api
16077   */
16078  getFill() {
16079    return this.fill_;
16080  }
16081  /**
16082   * Set the fill style.
16083   * @param {import("./Fill.js").default} fill Fill style.
16084   * @api
16085   */
16086  setFill(t) {
16087    this.fill_ = t, this.render();
16088  }
16089  /**
16090   * @return {HTMLCanvasElement} Image element.
16091   */
16092  getHitDetectionImage() {
16093    return this.hitDetectionCanvas_ || this.createHitDetectionCanvas_(this.renderOptions_), this.hitDetectionCanvas_;
16094  }
16095  /**
16096   * Get the image icon.
16097   * @param {number} pixelRatio Pixel ratio.
16098   * @return {HTMLCanvasElement} Image or Canvas element.
16099   * @api
16100   */
16101  getImage(t) {
16102    let i = this.canvas_[t];
16103    if (!i) {
16104      const s = this.renderOptions_, n = re(
16105        s.size * t,
16106        s.size * t
16107      );
16108      this.draw_(s, n, t), i = n.canvas, this.canvas_[t] = i;
16109    }
16110    return i;
16111  }
16112  /**
16113   * Get the image pixel ratio.
16114   * @param {number} pixelRatio Pixel ratio.
16115   * @return {number} Pixel ratio.
16116   */
16117  getPixelRatio(t) {
16118    return t;
16119  }
16120  /**
16121   * @return {import("../size.js").Size} Image size.
16122   */
16123  getImageSize() {
16124    return this.size_;
16125  }
16126  /**
16127   * @return {import("../ImageState.js").default} Image state.
16128   */
16129  getImageState() {
16130    return rt.LOADED;
16131  }
16132  /**
16133   * Get the origin of the symbolizer.
16134   * @return {Array<number>} Origin.
16135   * @api
16136   */
16137  getOrigin() {
16138    return this.origin_;
16139  }
16140  /**
16141   * Get the number of points for generating the shape.
16142   * @return {number} Number of points for stars and regular polygons.
16143   * @api
16144   */
16145  getPoints() {
16146    return this.points_;
16147  }
16148  /**
16149   * Get the (primary) radius for the shape.
16150   * @return {number} Radius.
16151   * @api
16152   */
16153  getRadius() {
16154    return this.radius_;
16155  }
16156  /**
16157   * Get the secondary radius for the shape.
16158   * @return {number|undefined} Radius2.
16159   * @api
16160   */
16161  getRadius2() {
16162    return this.radius2_;
16163  }
16164  /**
16165   * Get the size of the symbolizer (in pixels).
16166   * @return {import("../size.js").Size} Size.
16167   * @api
16168   */
16169  getSize() {
16170    return this.size_;
16171  }
16172  /**
16173   * Get the stroke style for the shape.
16174   * @return {import("./Stroke.js").default} Stroke style.
16175   * @api
16176   */
16177  getStroke() {
16178    return this.stroke_;
16179  }
16180  /**
16181   * Set the stroke style.
16182   * @param {import("./Stroke.js").default} stroke Stroke style.
16183   * @api
16184   */
16185  setStroke(t) {
16186    this.stroke_ = t, this.render();
16187  }
16188  /**
16189   * @param {function(import("../events/Event.js").default): void} listener Listener function.
16190   */
16191  listenImageChange(t) {
16192  }
16193  /**
16194   * Load not yet loaded URI.
16195   */
16196  load() {
16197  }
16198  /**
16199   * @param {function(import("../events/Event.js").default): void} listener Listener function.
16200   */
16201  unlistenImageChange(t) {
16202  }
16203  /**
16204   * Calculate additional canvas size needed for the miter.
16205   * @param {string}
16205 lineJoin Line join
16206   * @param {number} strokeWidth Stroke width
16207   * @param {number} miterLimit Miter limit
16208   * @return {number} Additional canvas size needed
16209   * @private
16210   */
16211  calculateLineJoinSize_(t, i, s) {
16212    if (i === 0 || this.points_ === 1 / 0 || t !== "bevel" && t !== "miter")
16213      return i;
16214    let n = this.radius_, r = this.radius2_ === void 0 ? n : this.radius2_;
16215    if (n < r) {
16216      const w = n;
16217      n = r, r = w;
16218    }
16219    const o = this.radius2_ === void 0 ? this.points_ : this.points_ * 2, a = 2 * Math.PI / o, l = r * Math.sin(a), h = Math.sqrt(r * r - l * l), c = n - h, u = Math.sqrt(l * l + c * c), d = u / l;
16220    if (t === "miter" && d <= s)
16221      return d * i;
16222    const f = i / 2 / d, g = i / 2 * (c / u), m = Math.sqrt((n + f) * (n + f) + g * g) - n;
16223    if (this.radius2_ === void 0 || t === "bevel")
16224      return m * 2;
16225    const p = n * Math.sin(a), y = Math.sqrt(n * n - p * p), v = r - y, C = Math.sqrt(p * p + v * v) / p;
16226    if (C <= s) {
16227      const w = C * i / 2 - r - n;
16228      return 2 * Math.max(m, w);
16229    }
16230    return m * 2;
16231  }
16232  /**
16233   * @return {RenderOptions}  The render options
16234   * @protected
16235   */
16236  createRenderOptions() {
16237    let t = wn, i = 0, s = null, n = 0, r, o = 0;
16238    this.stroke_ && (r = this.stroke_.getColor(), r === null && (r = gr), r = Ze(r), o = this.stroke_.getWidth(), o === void 0 && (o = mr), s = this.stroke_.getLineDash(), n = this.stroke_.getLineDashOffset(), t = this.stroke_.getLineJoin(), t === void 0 && (t = wn), i = this.stroke_.getMiterLimit(), i === void 0 && (i = fr));
16239    const a = this.calculateLineJoinSize_(t, o, i), l = Math.max(this.radius_, this.radius2_ || 0), h = Math.ceil(2 * l + a);
16240    return {
16241      strokeStyle: r,
16242      strokeWidth: o,
16243      size: h,
16244      lineDash: s,
16245      lineDashOffset: n,
16246      lineJoin: t,
16247      miterLimit: i
16248    };
16249  }
16250  /**
16251   * @protected
16252   */
16253  render() {
16254    this.renderOptions_ = this.createRenderOptions();
16255    const t = this.renderOptions_.size;
16256    this.canvas_ = {}, this.size_ = [t, t];
16257  }
16258  /**
16259   * @private
16260   * @param {RenderOptions} renderOptions Render options.
16261   * @param {CanvasRenderingContext2D} context The rendering context.
16262   * @param {number} pixelRatio The pixel ratio.
16263   */
16264  draw_(t, i, s) {
16265    if (i.scale(s, s), i.translate(t.size / 2, t.size / 2), this.createPath_(i), this.fill_) {
16266      let n = this.fill_.getColor();
16267      n === null && (n = xi), i.fillStyle = Ze(n), i.fill();
16268    }
16269    this.stroke_ && (i.strokeStyle = t.strokeStyle, i.lineWidth = t.strokeWidth, t.lineDash && (i.setLineDash(t.lineDash), i.lineDashOffset = t.lineDashOffset), i.lineJoin = t.lineJoin, i.miterLimit = t.miterLimit, i.stroke());
16270  }
16271  /**
16272   * @private
16273   * @param {RenderOptions} renderOptions Render options.
16274   */
16275  createHitDetectionCanvas_(t) {
16276    if (this.fill_) {
16277      let i = this.fill_.getColor(), s = 0;
16278      if (typeof i == "string" && (i = Lo(i)), i === null ? s = 1 : Array.isArray(i) && (s = i.length === 4 ? i[3] : 1), s === 0) {
16279        const n = re(
16280          t.size,
16281          t.size
16282        );
16283        this.hitDetectionCanvas_ = n.canvas, this.drawHitDetectionCanvas_(t, n);
16284      }
16285    }
16286    this.hitDetectionCanvas_ || (this.hitDetectionCanvas_ = this.getImage(1));
16287  }
16288  /**
16289   * @private
16290   * @param {CanvasRenderingContext2D} context The context to draw in.
16291   */
16292  createPath_(t) {
16293    let i = this.points_;
16294    const s = this.radius_;
16295    if (i === 1 / 0)
16296      t.arc(0, 0, s, 0, 2 * Math.PI);
16297    else {
16298      const n = this.radius2_ === void 0 ? s : this.radius2_;
16299      this.radius2_ !== void 0 && (i *= 2);
16300      const r = this.angle_ - Math.PI / 2, o = 2 * Math.PI / i;
16301      for (let a = 0; a < i; a++) {
16302        const l = r + a * o, h = a % 2 === 0 ? s : n;
16303        t.lineTo(h * Math.cos(l), h * Math.sin(l));
16304      }
16305      t.closePath();
16306    }
16307  }
16308  /**
16309   * @private
16310   * @param {RenderOptions} renderOptions Render options.
16311   * @param {CanvasRenderingContext2D} context The context.
16312   */
16313  drawHitDetectionCanvas_(t, i) {
16314    i.translate(t.size / 2, t.size / 2), this.createPath_(i), i.fillStyle = xi, i.fill(), this.stroke_ && (i.strokeStyle = t.strokeStyle, i.lineWidth = t.strokeWidth, t.lineDash && (i.setLineDash(t.lineDash), i.lineDashOffset = t.lineDashOffset), i.lineJoin = t.lineJoin, i.miterLimit = t.miter
16314Limit, i.stroke());
16315  }
16316}
16317const Tg = Hh;
16318class Zh extends Tg {
16319  /**
16320   * @param {Options} [options] Options.
16321   */
16322  constructor(t) {
16323    t = t || { radius: 5 }, super({
16324      points: 1 / 0,
16325      fill: t.fill,
16326      radius: t.radius,
16327      stroke: t.stroke,
16328      scale: t.scale !== void 0 ? t.scale : 1,
16329      rotation: t.rotation !== void 0 ? t.rotation : 0,
16330      rotateWithView: t.rotateWithView !== void 0 ? t.rotateWithView : !1,
16331      displacement: t.displacement !== void 0 ? t.displacement : [0, 0],
16332      declutterMode: t.declutterMode
16333    });
16334  }
16335  /**
16336   * Clones the style.
16337   * @return {CircleStyle} The cloned style.
16338   * @api
16339   */
16340  clone() {
16341    const t = this.getScale(), i = new Zh({
16342      fill: this.getFill() ? this.getFill().clone() : void 0,
16343      stroke: this.getStroke() ? this.getStroke().clone() : void 0,
16344      radius: this.getRadius(),
16345      scale: Array.isArray(t) ? t.slice() : t,
16346      rotation: this.getRotation(),
16347      rotateWithView: this.getRotateWithView(),
16348      displacement: this.getDisplacement().slice(),
16349      declutterMode: this.getDeclutterMode()
16350    });
16351    return i.setOpacity(this.getOpacity()), i;
16352  }
16353  /**
16354   * Set the circle radius.
16355   *
16356   * @param {number} radius Circle radius.
16357   * @api
16358   */
16359  setRadius(t) {
16360    this.radius_ = t, this.render();
16361  }
16362}
16363const Fr = Zh;
16364class Wi {
16365  /**
16366   * @param {Options} [options] Style options.
16367   */
16368  constructor(t) {
16369    t = t || {}, this.geometry_ = null, this.geometryFunction_ = Du, t.geometry !== void 0 && this.setGeometry(t.geometry), this.fill_ = t.fill !== void 0 ? t.fill : null, this.image_ = t.image !== void 0 ? t.image : null, this.renderer_ = t.renderer !== void 0 ? t.renderer : null, this.hitDetectionRenderer_ = t.hitDetectionRenderer !== void 0 ? t.hitDetectionRenderer : null, this.stroke_ = t.stroke !== void 0 ? t.stroke : null, this.text_ = t.text !== void 0 ? t.text : null, this.zIndex_ = t.zIndex;
16370  }
16371  /**
16372   * Clones the style.
16373   * @return {Style} The cloned style.
16374   * @api
16375   */
16376  clone() {
16377    let t = this.getGeometry();
16378    return t && typeof t == "object" && (t = /** @type {import("../geom/Geometry.js").default} */
16379    t.clone()), new Wi({
16380      geometry: t,
16381      fill: this.getFill() ? this.getFill().clone() : void 0,
16382      image: this.getImage() ? this.getImage().clone() : void 0,
16383      renderer: this.getRenderer(),
16384      stroke: this.getStroke() ? this.getStroke().clone() : void 0,
16385      text: this.getText() ? this.getText().clone() : void 0,
16386      zIndex: this.getZIndex()
16387    });
16388  }
16389  /**
16390   * Get the custom renderer function that was configured with
16391   * {@link #setRenderer} or the `renderer` constructor option.
16392   * @return {RenderFunction|null} Custom renderer function.
16393   * @api
16394   */
16395  getRenderer() {
16396    return this.renderer_;
16397  }
16398  /**
16399   * Sets a custom renderer function for this style. When set, `fill`, `stroke`
16400   * and `image` options of the style will be ignored.
16401   * @param {RenderFunction|null} renderer Custom renderer function.
16402   * @api
16403   */
16404  setRenderer(t) {
16405    this.renderer_ = t;
16406  }
16407  /**
16408   * Sets a custom renderer function for this style used
16409   * in hit detection.
16410   * @param {RenderFunction|null} renderer Custom renderer function.
16411   * @api
16412   */
16413  setHitDetectionRenderer(t) {
16414    this.hitDetectionRenderer_ = t;
16415  }
16416  /**
16417   * Get the custom renderer function that was configured with
16418   * {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.
16419   * @return {RenderFunction|null} Custom renderer function.
16420   * @api
16421   */
16422  getHitDetectionRenderer() {
16423    return this.hitDetectionRenderer_;
16424  }
16425  /**
16426   * Get the geometry to be rendered.
16427   * @return {string|import("../geom/Geometry.js").default|GeometryFunction}
16428   * Feature property or geometry or function that returns the geometry that will
16429   * be rendered with this style.
16430   * @api
16431   */
16432  getGeometry() {
16433    return this.geometry_;
16434  }
16435  /**
16436   * Get the function used to generate a geometry for rendering.
16437   * @return {!GeometryFunction} Function that is called with a feature
16438   * and returns the geometry to render instead of the feature's geometry.
16439   * @api
16440   */
16441  getGeometryFunction() {
16442    return this.geometryFunction_;
16443  }
16444  /**
16445   * Get the fill style.
16446   * @return {import("./Fill.js").default} Fill style.
16447   * @api
16448   */
16449  getFill() {
16450    return this.fill_;
16451  }
16452  /**
16453   * Set the fill style.
16454   * @param {import("./Fill.js").default} fill Fill style.
16455   * @api
16456   */
16457  setFill(t) {
16458    this.fill_ = t;
16459  }
16460  /**
16461   * Get the image style.
16462   * @return {import("./Image.js").default} Image style.
16463   * @api
16464   */
16465  getImage() {
16466    return this.image_;
16467  }
16468  /**
16469   * Set the image style.
16470   * @param {import("./Image.js").default} image Image style.
16471   * @api
16472   */
16473  setImage(t) {
16474    this.image_ = t;
16475  }
16476  /**
16477   * Get the stroke style.
16478   * @return {import("./Stroke.js").default} Stroke style.
16479   * @api
16480   */
16481  getStroke() {
16482    return this.stroke_;
16483  }
16484  /**
16485   * Set the stroke style.
16486   * @param {import("./Stroke.js").default} stroke Stroke style.
16487   * @api
16488   */
16489  setStroke(t) {
16490    this.stroke_ = t;
16491  }
16492  /**
16493   * Get the text style.
16494   * @return {import("./Text.js").default} Text style.
16495   * @api
16496   */
16497  getText() {
16498    return this.text_;
16499  }
16500  /**
16501   * Set the text style.
16502   * @param {import("./Text.js").default} text Text style.
16503   * @api
16504   */
16505  setText(t) {
16506    this.text_ = t;
16507  }
16508  /**
16509   * Get the z-index for the style.
16510   * @return {number|undefined} ZIndex.
16511   * @api
16512   */
16513  getZIndex() {
16514    return this.zIndex_;
16515  }
16516  /**
16517   * Set a geometry that is rendered instead of the feature's geometry.
16518   *
16519   * @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
16520   *     Feature property or geometry or function returning a geometry to render
16521   *     for this style.
16522   * @api
16523   */
16524  setGeometry(t) {
16525    typeof t == "function" ? this.geometryFunction_ = t : typeof t == "string" ? this.geometryFunction_ = function(i) {
16526      return (
16527        /** @type {import("../geom/Geometry.js").default} */
16528        i.get(t)
16529      );
16530    } : t ? t !== void 0 && (this.geometryFunction_ = function() {
16531      return (
16532        /** @type {import("../geom/Geometry.js").default} */
16533        t
16534      );
16535    }) : this.geometryFunction_ = Du, this.geometry_ = t;
16536  }
16537  /**
16538   * Set the z-index.
16539   *
16540   * @param {number|undefined} zIndex ZIndex.
16541   * @api
16542   */
16543  setZIndex(t) {
16544    this.zIndex_ = t;
16545  }
16546}
16547function CC(e) {
16548  let t;
16549  if (typeof e == "function")
16550    t = e;
16551  else {
16552    let i;
16553    Array.isArray(e) ? i = e : (at(typeof /** @type {?} */
16554    e.getZIndex == "function", 41), i = [
16555      /** @type {Style} */
16556      e
16557    ]), t = function() {
16558      return i;
16559    };
16560  }
16561  return t;
16562}
16563let Wa = null;
16564function bC(e, t) {
16565  if (!Wa) {
16566    const i = new Mi({
16567      color: "rgba(255,255,255,0.4)"
16568    }), s = new vi({
16569      color: "#3399CC",
16570      width: 1.25
16571    });
16572    Wa = [
16573      new Wi({
16574        image: new Fr({
16575          fill: i,
16576          stroke: s,
16577          radius: 5
16578        }),
16579        fill: i,
16580        stroke: s
16581      })
16582    ];
16583  }
16584  return Wa;
16585}
16586function Rg() {
16587  const e = {}, t = [255, 255, 255, 1], i = [0, 153, 255, 1], s = 3;
16588  return e.Polygon = [
16589    new Wi({
16590      fill: new Mi({
16591        color: [255, 255, 255, 0.5]
16592      })
16593    })
16594  ], e.MultiPolygon = e.Polygon, e.LineString = [
16595    new Wi({
16596      stroke: new vi({
16597        color: t,
16598        width: s + 2
16599      })
16600    }),
16601    new Wi({
16602      stroke: new vi({
16603        color: i,
16604        width: s
16605      })
16606    })
16607  ], e.MultiLineString = e.LineString, e.Circle = e.Polygon.concat(e.LineString), e.Point = [
16608    new Wi({
16609      image: new Fr({
16610        radius: s * 2,
16611        fill: new Mi({
16612          color: i
16613        }),
16614        stroke: new vi({
16615          color: t,
16616          width: s / 2
16617        })
16618      }),
16619      zIndex: 1 / 0
16620    })
16621  ], e.MultiPoint = e.Point, e.GeometryCollection = e.Polygon.concat(
16622    e.LineString,
16623    e.Point
16624  ), e;
16625}
16626function Du(e) {
16627  return e.getGeometry();
16628}
16629const pr = Wi, wC = "#333";
16630class Jh {
16631  /**
16632   * @param {Options} [options] Options.
16633   */
16634  constructor(t) {
16635    t = t || {}, this.font_ = t.font, this.rotation_ = t.rotation, this.rotateWithView_ = t.rotateWithView, this.scale_ = t.scale, this.scaleArray_ = ye(t.scale !== void 0 ? t.scale : 1), this.text_ = t.text, this.textAlign_ = t.textAlign, this.justify_ = t.justify, this.repeat_ = t.repeat, this.textBaseline_ = t.textBaseline, this.fill_ = t.fill !== void 0 ? t.fill : new Mi({ color: wC }), this.maxAngle_ = t.maxAngle !== void 0 ? t.maxAngle : Math.PI / 4, this.placement_ = t.placement !== void 0 ? t.placement : "point", this.overflow_ = !!t.overflow, this.stroke_ = t.stroke !== void 0 ? t.stroke : null, this.offsetX_ = t.offsetX !== void 0 ? t.offsetX : 0, this.offsetY_ = t.offsetY !== void 0 ? t.offsetY : 0, this.backgroundFill_ = t.backgroundFill ? t.backgroundFill : null, this.backgroundStroke_ = t.backgroundStroke ? t.backgroundStroke : null, this.padding_ = t.padding === void 0 ? null : t.padding;
16636  }
16637  /**
16638   * Clones the style.
16639   * @return {Text} The cloned style.
16640   * @api
16641   */
16642  clone() {
16643    const t = this.getScale();
16644    return new Jh({
16645      font: this.getFont(),
16646      placement: this.getPlacement(),
16647      repeat: this.getRepeat(),
16648      maxAngle: this.getMaxAngle(),
16649      overflow: this.getOverflow(),
16650      rotation: this.getRotation(),
16651      rotateWithView: this.getRotateWithView(),
16652      scale: Array.isArray(t) ? t.slice() : t,
16653      text: this.getText(),
16654      textAlign: this.getTextAlign(),
16655      justify: this.getJustify(),
16656      textBaseline: this.getTextBaseline(),
16657      fill: this.getFill() ? this.getFill().clone() : void 0,
16658      stroke: this.getStroke() ? this.getStroke().clone() : void 0,
16659      offsetX: this.getOffsetX(),
16660      offsetY: this.getOffsetY(),
16661      backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : void 0,
16662      backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : void 0,
16663      padding: this.getPadding() || void 0
16664    });
16665  }
16666  /**
16667   * Get the `overflow` configuration.
16668   * @return {boolean} Let text overflow the length of the path they follow.
16669   * @api
16670   */
16671  getOverflow() {
16672    return this.overflow_;
16673  }
16674  /**
16675   * Get the font name.
16676   * @return {string|undefined} Font.
16677   * @api
16678   */
16679  getFont() {
16680    return this.font_;
16681  }
16682  /**
16683   * Get the maximum angle between adjacent characters.
16684   * @return {number} Angle in radians.
16685   * @api
16686   */
16687  getMaxAngle() {
16688    return this.maxAngle_;
16689  }
16690  /**
16691   * Get the label placement.
16692   * @return {TextPlacement} Text placement.
16693   * @api
16694   */
16695  getPlacement() {
16696    return this.placement_;
16697  }
16698  /**
16699   * Get the repeat interval of the text.
16700   * @return {number|undefined} Repeat interval in pixels.
16701   * @api
16702   */
16703  getRepeat() {
16704    return this.repeat_;
16705  }
16706  /**
16707   * Get the x-offset for the text.
16708   * @return {number} Horizontal text offset.
16709   * @api
16710   */
16711  getOffsetX() {
16712    return this.offsetX_;
16713  }
16714  /**
16715   * Get the y-offset for the text.
16716   * @return {number} Vertical text offset.
16717   * @api
16718   */
16719  getOffsetY() {
16720    return this.offsetY_;
16721  }
16722  /**
16723   * Get the fill style for the text.
16724   * @return {import("./Fill.js").default} Fill style.
16725   * @api
16726   */
16727  getFill() {
16728    return this.fill_;
16729  }
16730  /**
16731   * Determine whether the text rotates with the map.
16732   * @return {boolean|undefined} Rotate with map.
16733   * @api
16734   */
16735  getRotateWithView() {
16736    return this.rotateWithView_;
16737  }
16738  /**
16739   * Get the text rotation.
16740   * @return {number|undefined} Rotation.
16741   * @api
16742   */
16743  getRotation() {
16744    return this.rotation_;
16745  }
16746  /**
16747   * Get the text scale.
16748   * @return {number|import("../size.js").Size|undefined} Scale.
16749   * @api
16750   */
16751  getScale() {
16752    return this.scale_;
16753  }
16754  /**
16755   * Get the symbolizer scale array.
16756   * @return {import("../size.js").Size} Scale array.
16757   */
16758  getScaleArray() {
16759    return this.scaleArray_;
16760  }
16761  /**
16762   * Get the stroke style for the text.
16763   * @return {import("./Stroke.js").default} Stroke style.
16764   * @api
16765   */
16766  getStroke() {
16767    return this.stroke_;
16768  }
16769  /**
16770   * Get the text to be rendered.
16771   * @return {string|Array<string>|undefined} Text.
16772   * @api
16773   */
16774  getText() {
16775    return this.text_;
16776  }
16777  /**
16778   * Get the text alignment.
16779   * @return {CanvasTextAlign|undefined} Text align.
16780   * @api
16781   */
16782  getTextAlign() {
16783    return this.textAlign_;
16784  }
16785  /**
16786   * Get the justification.
16787   * @return {TextJustify|undefined} Justification.
16788   * @api
16789   */
16790  getJustify() {
16791    return this.justify_;
16792  }
16793  /**
16794   * Get the text baseline.
16795   * @return {CanvasTextBaseline|undefined} Text baseline.
16796   * @api
16797   */
16798  getTextBaseline() {
16799    return this.textBaseline_;
16800  }
16801  /**
16802   * Get the background fill style for the text.
16803   * @return {import("./Fill.js").default} Fill style.
16804   * @api
16805   */
vendor: 10,094 bytes, lines 16806-17200
16806  getBackgroundFill() {
16807    return this.backgroundFill_;
16808  }
16809  /**
16810   * Get the background stroke style for the text.
16811   * @return {import("./Stroke.js").default} Stroke style.
16812   * @api
16813   */
16814  getBackgroundStroke() {
16815    return this.backgroundStroke_;
16816  }
16817  /**
16818   * Get the padding for the text.
16819   * @return {Array<number>|null} Padding.
16820   * @api
16821   */
16822  getPadding() {
16823    return this.padding_;
16824  }
16825  /**
16826   * Set the `overflow` property.
16827   *
16828   * @param {boolean} overflow Let text overflow the path that it follows.
16829   * @api
16830   */
16831  setOverflow(t) {
16832    this.overflow_ = t;
16833  }
16834  /**
16835   * Set the font.
16836   *
16837   * @param {string|undefined} font Font.
16838   * @api
16839   */
16840  setFont(t) {
16841    this.font_ = t;
16842  }
16843  /**
16844   * Set the maximum angle between adjacent characters.
16845   *
16846   * @param {number} maxAngle Angle in radians.
16847   * @api
16848   */
16849  setMaxAngle(t) {
16850    this.maxAngle_ = t;
16851  }
16852  /**
16853   * Set the x offset.
16854   *
16855   * @param {number} offsetX Horizontal text offset.
16856   * @api
16857   */
16858  setOffsetX(t) {
16859    this.offsetX_ = t;
16860  }
16861  /**
16862   * Set the y offset.
16863   *
16864   * @param {number} offsetY Vertical text offset.
16865   * @api
16866   */
16867  setOffsetY(t) {
16868    this.offsetY_ = t;
16869  }
16870  /**
16871   * Set the text placement.
16872   *
16873   * @param {TextPlacement} placement Placement.
16874   * @api
16875   */
16876  setPlacement(t) {
16877    this.placement_ = t;
16878  }
16879  /**
16880   * Set the repeat interval of the text.
16881   * @param {number|undefined} [repeat] Repeat interval in pixels.
16882   * @api
16883   */
16884  setRepeat(t) {
16885    this.repeat_ = t;
16886  }
16887  /**
16888   * Set whether to rotate the text with the view.
16889   *
16890   * @param {boolean} rotateWithView Rotate with map.
16891   * @api
16892   */
16893  setRotateWithView(t) {
16894    this.rotateWithView_ = t;
16895  }
16896  /**
16897   * Set the fill.
16898   *
16899   * @param {import("./Fill.js").default} fill Fill style.
16900   * @api
16901   */
16902  setFill(t) {
16903    this.fill_ = t;
16904  }
16905  /**
16906   * Set the rotation.
16907   *
16908   * @param {number|undefined} rotation Rotation.
16909   * @api
16910   */
16911  setRotation(t) {
16912    this.rotation_ = t;
16913  }
16914  /**
16915   * Set the scale.
16916   *
16917   * @param {number|import("../size.js").Size|undefined} scale Scale.
16918   * @api
16919   */
16920  setScale(t) {
16921    this.scale_ = t, this.scaleArray_ = ye(t !== void 0 ? t : 1);
16922  }
16923  /**
16924   * Set the stroke.
16925   *
16926   * @param {import("./Stroke.js").default} stroke Stroke style.
16927   * @api
16928   */
16929  setStroke(t) {
16930    this.stroke_ = t;
16931  }
16932  /**
16933   * Set the text.
16934   *
16935   * @param {string|Array<string>|undefined} text Text.
16936   * @api
16937   */
16938  setText(t) {
16939    this.text_ = t;
16940  }
16941  /**
16942   * Set the text alignment.
16943   *
16944   * @param {CanvasTextAlign|undefined} textAlign Text align.
16945   * @api
16946   */
16947  setTextAlign(t) {
16948    this.textAlign_ = t;
16949  }
16950  /**
16951   * Set the justification.
16952   *
16953   * @param {TextJustify|undefined} justify Justification.
16954   * @api
16955   */
16956  setJustify(t) {
16957    this.justify_ = t;
16958  }
16959  /**
16960   * Set the text baseline.
16961   *
16962   * @param {CanvasTextBaseline|undefined} textBaseline Text baseline.
16963   * @api
16964   */
16965  setTextBaseline(t) {
16966    this.textBaseline_ = t;
16967  }
16968  /**
16969   * Set the background fill.
16970   *
16971   * @param {import("./Fill.js").default} fill Fill style.
16972   * @api
16973   */
16974  setBackgroundFill(t) {
16975    this.backgroundFill_ = t;
16976  }
16977  /**
16978   * Set the background stroke.
16979   *
16980   * @param {import("./Stroke.js").default} stroke Stroke style.
16981   * @api
16982   */
16983  setBackgroundStroke(t) {
16984    this.backgroundStroke_ = t;
16985  }
16986  /**
16987   * Set the padding (`[top, right, bottom, left]`).
16988   *
16989   * @param {Array<number>|null} padding Padding.
16990   * @api
16991   */
16992  setPadding(t) {
16993    this.padding_ = t;
16994  }
16995}
16996const SC = Jh;
16997function TC(e, t, i, s, n) {
16998  Ig(e, t, i || 0, s || e.length - 1, n || RC);
16999}
17000function Ig(e, t, i, s, n) {
17001  for (; s > i; ) {
17002    if (s - i > 600) {
17003      var r = s - i + 1, o = t - i + 1, a = Math.log(r), l = 0.5 * Math.exp(2 * a / 3), h = 0.5 * Math.sqrt(a * l * (r - l) / r) * (o - r / 2 < 0 ? -1 : 1), c = Math.max(i, Math.floor(t - o * l / r + h)), u = Math.min(s, Math.floor(t + (r - o) * l / r + h));
17004      Ig(e, t, c, u, n);
17005    }
17006    var d = e[t], f = i, g = s;
17007    for (Dn(e, i, t), n(e[s], d) > 0 && Dn(e, i, s); f < g; ) {
17008      for (Dn(e, f, g), f++, g--; n(e[f], d) < 0; )
17009        f++;
17010      for (; n(e[g], d) > 0; )
17011        g--;
17012    }
17013    n(e[i], d) === 0 ? Dn(e, i, g) : (g++, Dn(e, g, s)), g <= t && (i = g + 1), t <= g && (s = g - 1);
17014  }
17015}
17016function Dn(e, t, i) {
17017  var s = e[t];
17018  e[t] = e[i], e[i] = s;
17019}
17020function RC(e, t) {
17021  return e < t ? -1 : e > t ? 1 : 0;
17022}
17023let Pg = class {
17024  constructor(t = 9) {
17025    this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
17026  }
17027  all() {
17028    return this._all(this.data, []);
17029  }
17030  search(t) {
17031    let i = this.data;
17032    const s = [];
17033    if (!to(t, i))
17034      return s;
17035    const n = this.toBBox, r = [];
17036    for (; i; ) {
17037      for (let o = 0; o < i.children.length; o++) {
17038        const a = i.children[o], l = i.leaf ? n(a) : a;
17039        to(t, l) && (i.leaf ? s.push(a) : Ua(t, l) ? this._all(a, s) : r.push(a));
17040      }
17041      i = r.pop();
17042    }
17043    return s;
17044  }
17045  collides(t) {
17046    let i = this.data;
17047    if (!to(t, i))
17048      return !1;
17049    const s = [];
17050    for (; i; ) {
17051      for (let n = 0; n < i.children.length; n++) {
17052        const r = i.children[n], o = i.leaf ? this.toBBox(r) : r;
17053        if (to(t, o)) {
17054          if (i.leaf || Ua(t, o))
17055            return !0;
17056          s.push(r);
17057        }
17058      }
17059      i = s.pop();
17060    }
17061    return !1;
17062  }
17063  load(t) {
17064    if (!(t && t.length))
17065      return this;
17066    if (t.length < this._minEntries) {
17067      for (let s = 0; s < t.length; s++)
17068        this.insert(t[s]);
17069      return this;
17070    }
17071    let i = this._build(t.slice(), 0, t.length - 1, 0);
17072    if (!this.data.children.length)
17073      this.data = i;
17074    else if (this.data.height === i.height)
17075      this._splitRoot(this.data, i);
17076    else {
17077      if (this.data.height < i.height) {
17078        const s = this.data;
17079        this.data = i, i = s;
17080      }
17081      this._insert(i, this.data.height - i.height - 1, !0);
17082    }
17083    return this;
17084  }
17085  insert(t) {
17086    return t && this._insert(t, this.data.height - 1), this;
17087  }
17088  clear() {
17089    return this.data = $s([]), this;
17090  }
17091  remove(t, i) {
17092    if (!t)
17093      return this;
17094    let s = this.data;
17095    const n = this.toBBox(t), r = [], o = [];
17096    let a, l, h;
17097    for (; s || r.length; ) {
17098      if (s || (s = r.pop(), l = r[r.length - 1], a = o.pop(), h = !0), s.leaf) {
17099        const c = IC(t, s.children, i);
17100        if (c !== -1)
17101          return s.children.splice(c, 1), r.push(s), this._condense(r), this;
17102      }
17103      !h && !s.leaf && Ua(s, n) ? (r.push(s), o.push(a), a = 0, l = s, s = s.children[0]) : l ? (a++, s = l.children[a], h = !1) : s = null;
17104    }
17105    return this;
17106  }
17107  toBBox(t) {
17108    return t;
17109  }
17110  compareMinX(t, i) {
17111    return t.minX - i.minX;
17112  }
17113  compareMinY(t, i) {
17114    return t.minY - i.minY;
17115  }
17116  toJSON() {
17117    return this.data;
17118  }
17119  fromJSON(t) {
17120    return this.data = t, this;
17121  }
17122  _all(t, i) {
17123    const s = [];
17124    for (; t; )
17125      t.leaf ? i.push(...t.children) : s.push(...t.children), t = s.pop();
17126    return i;
17127  }
17128  _build(t, i, s, n) {
17129    const r = s - i + 1;
17130    let o = this._maxEntries, a;
17131    if (r <= o)
17132      return a = $s(t.slice(i, s + 1)), Gs(a, this.toBBox), a;
17133    n || (n = Math.ceil(Math.log(r) / Math.log(o)), o = Math.ceil(r / Math.pow(o, n - 1))), a = $s([]), a.leaf = !1, a.height = n;
17134    const l = Math.ceil(r / o), h = l * Math.ceil(Math.sqrt(o));
17135    Nu(t, i, s, h, this.compareMinX);
17136    for (let c = i; c <= s; c += h) {
17137      const u = Math.min(c + h - 1, s);
17138      Nu(t, c, u, l, this.compareMinY);
17139      for (let d = c; d <= u; d += l) {
17140        const f = Math.min(d + l - 1, u);
17141        a.children.push(this._build(t, d, f, n - 1));
17142      }
17143    }
17144    return Gs(a, this.toBBox), a;
17145  }
17146  _chooseSubtree(t, i, s, n) {
17147    for (; n.push(i), !(i.leaf || n.length - 1 === s); ) {
17148      let r = 1 / 0, o = 1 / 0, a;
17149      for (let l = 0; l < i.children.length; l++) {
17150        const h = i.children[l], c = Ba(h), u = LC(t, h) - c;
17151        u < o ? (o = u, r = c < r ? c : r, a = h) : u === o && c < r && (r = c, a = h);
17152      }
17153      i = a || i.children[0];
17154    }
17155    return i;
17156  }
17157  _insert(t, i, s) {
17158    const n = s ? t : this.toBBox(t), r = [], o = this._chooseSubtree(n, this.data, i, r);
17159    for (o.children.push(t), Yn(o, n); i >= 0 && r[i].children.length > this._maxEntries; )
17160      this._split(r, i), i--;
17161    this._adjustParentBBoxes(n, r, i);
17162  }
17163  // split overflowed node into two
17164  _split(t, i) {
17165    const s = t[i], n = s.children.length, r = this._minEntries;
17166    this._chooseSplitAxis(s, r, n);
17167    const o = this._chooseSplitIndex(s, r, n), a = $s(s.children.splice(o, s.children.length - o));
17168    a.height = s.height, a.leaf = s.leaf, Gs(s, this.toBBox), Gs(a, this.toBBox), i ? t[i - 1].children.push(a) : this._splitRoot(s, a);
17169  }
17170  _splitRoot(t, i) {
17171    this.data = $s([t, i]), this.data.height = t.height + 1, this.data.leaf = !1, Gs(this.data, this.toBBox);
17172  }
17173  _chooseSplitIndex(t, i, s) {
17174    let n, r = 1 / 0, o = 1 / 0;
17175    for (let a = i; a <= s - i; a++) {
17176      const l = $n(t, 0, a, this.toBBox), h = $n(t, a, s, this.toBBox), c = OC(l, h), u = Ba(l) + Ba(h);
17177      c < r ? (r = c, n = a, o = u < o ? u : o) : c === r && u < o && (o = u, n = a);
17178    }
17179    return n || s - i;
17180  }
17181  // sorts node children by the best axis for split
17182  _chooseSplitAxis(t, i, s) {
17183    const n = t.leaf ? this.compareMinX : PC, r = t.leaf ? this.compareMinY : AC, o = this._allDistMargin(t, i, s, n), a = this._allDistMargin(t, i, s, r);
17184    o < a && t.children.sort(n);
17185  }
17186  // total margin of all possible split distributions where each node is at least m full
17187  _allDistMargin(t, i, s, n) {
17188    t.children.sort(n);
17189    const r = this.toBBox, o = $n(t, 0, i, r), a = $n(t, s - i, s, r);
17190    let l = Qr(o) + Qr(a);
17191    for (let h = i; h < s - i; h++) {
17192      const c = t.children[h];
17193      Yn(o, t.leaf ? r(c) : c), l += Qr(o);
17194    }
17195    for (let h = s - i - 1; h >= i; h--) {
17196      const c = t.children[h];
17197      Yn(a, t.leaf ? r(c) : c), l += Qr(a);
17198    }
17199    return l;
17200  }
17201  _adjustParentBBoxes(t, i, s) {
17202    for (let n = s; n >= 0; n--)
17203      Yn(i[n], t);
17204  }
17205  _condense(t) {
17206    for (let i = t.length - 1, s; i >= 0; i--)
17207      t[i].children.length === 0 ? i > 0 ? (s = t[i - 1].children, s.splice(s.indexOf(t[i]), 1)) : this.clear() : Gs(t[i], this.toBBox);
17208  }
17209};
17210function IC(e, t, i) {
17211  if (!i)
17212    return t.indexOf(e);
17213  for (let s = 0; s < t.length; s++)
17214    if (i(e, t[s]))
17215      return s;
17216  return -1;
17217}
17218function Gs(e, t) {
17219  $n(e, 0, e.children.length, t, e);
17220}
17221function $n(e, t, i, s, n) {
17222  n || (n = $s(null)), n.minX = 1 / 0, n.minY = 1 / 0, n.maxX = -1 / 0, n.maxY = -1 / 0;
17223  for (let r = t; r < i; r++) {
17224    const o = e.children[r];
17225    Yn(n, e.leaf ? s(o) : o);
17226  }
17227  return n;
17228}
17229function Yn(e, t) {
17230  return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
17231}
17232function PC(e, t) {
17233  return e.minX - t.minX;
17234}
17235function AC(e, t) {
17236  return e.minY - t.minY;
17237}
17238function Ba(e) {
17239  return (e.maxX - e.minX) * (e.maxY - e.minY);
17240}
17241function Qr(e) {
17242  return e.maxX - e.minX + (e.maxY - e.minY);
17243}
17244function LC(e, t) {
17245  return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
17246}
17247function OC(e, t) {
17248  const i = Math.max(e.minX, t.minX), s = Math.max(e.minY, t.minY), n = Math.min(e.maxX, t.maxX), r = Math.min(e.maxY, t.maxY);
17249  return Math.max(0, n - i) * Math.max(0, r - s);
17250}
17251function Ua(e, t) {
17252  return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
17253}
17254function to(e, t) {
17255  return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
17256}
17257function $s(e) {
17258  return {
17259    children: e,
17260    height: 1,
17261    leaf: !0,
17262    minX: 1 / 0,
17263    minY: 1 / 0,
17264    maxX: -1 / 0,
17265    maxY: -1 / 0
17266  };
17267}
17268function Nu(e, t, i, s, n) {
17269  const r = [t, i];
17270  for (; r.length; ) {
17271    if (i = r.pop(), t = r.pop(), i - t <= s)
17272      continue;
17273    const o = t + Math.ceil((i - t) / s / 2) * s;
17274    TC(e, o, t, i, n), r.push(t, o, o, i);
17275  }
17276}
17277class FC extends Ar {
17278  /**
17279   * @param {import("./extent.js").Extent} extent Extent.
17280   * @param {number|undefined} resolution Resolution.
17281   * @param {number} pixelRatio Pixel ratio.
17282   * @param {import("./ImageState.js").default} state State.
17283   */
17284  constructor(t, i, s, n) {
17285    super(), this.extent = t, this.pixelRatio_ = s, this.resolution = i, this.state = n;
17286  }
17287  /**
17288   * @protected
17289   */
17290  changed() {
17291    this.dispatchEvent(et.CHANGE);
17292  }
17293  /**
17294   * @return {import("./extent.js").Extent} Extent.
17295   */
17296  getExtent() {
17297    return this.extent;
17298  }
17299  /**
17300   * @abstract
17301   * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
17302   */
17303  getImage() {
17304    return Z();
17305  }
17306  /**
17307   * @return {number} PixelRatio.
17308   */
17309  getPixelRatio() {
17310    return this.pixelRatio_;
17311  }
17312  /**
17313   * @return {number} Resolution.
17314   */
17315  getResolution() {
17316    return (
17317      /** @type {number} */
17318      this.resolution
17319    );
17320  }
17321  /**
17322   * @return {import("./ImageState.js").default} State.
17323   */
17324  getState() {
17325    return this.state;
17326  }
17327  /**
17328   * Load not yet loaded URI.
17329   * @abstract
17330   */
17331  load() {
17332    Z();
17333  }
17334}
17335const Ag = FC;
17336class kC extends Ag {
17337  /**
17338   * @param {import("./extent.js").Extent} extent Extent.
17339   * @param {number|undefined} resolution Resolution.
17340   * @param {number} pixelRatio Pixel ratio.
17341   * @param {string} src Image source URI.
17342   * @param {?string} crossOrigin Cross origin.
17343   * @param {LoadFunction} imageLoadFunction Image load function.
17344   * @param {CanvasRenderingContext2D} [context] Canvas context. When provided, the image will be
17345   *    drawn into the context's canvas, and `getImage()` will return the canvas once the image
17346   *    has finished loading.
17347   */
17348  constructor(t, i, s, n, r, o, a) {
17349    super(t, i, s, rt.IDLE), this.src_ = n, this.image_ = new Image(), r !== null && (this.image_.crossOrigin = r), this.context_ = a, this.unlisten_ = null, this.state = rt.IDLE, this.imageLoadFunction_ = o;
17350  }
17351  /**
17352   * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
17353   * @api
17354   */
17355  getImage() {
17356    if (this.state == rt.LOADED && this.context_ && !(this.image_ instanceof HTMLCanvasElement)) {
17357      const t = this.context_.canvas;
17358      t.width = this.image_.width, t.height = this.image_.height, this.context_.drawImage(this.image_, 0, 0
17358), this.image_ = this.context_.canvas;
17359    }
17360    return this.image_;
17361  }
17362  /**
17363   * Tracks loading or read errors.
17364   *
17365   * @private
17366   */
17367  handleImageError_() {
17368    this.state = rt.ERROR, this.unlistenImage_(), this.changed();
17369  }
17370  /**
17371   * Tracks successful image load.
17372   *
17373   * @private
17374   */
17375  handleImageLoad_() {
17376    this.resolution === void 0 && (this.resolution = Yt(this.extent) / this.image_.height), this.state = rt.LOADED, this.unlistenImage_(), this.changed();
17377  }
17378  /**
17379   * Load the image or retry if loading previously failed.
17380   * Loading is taken care of by the tile queue, and calling this method is
17381   * only needed for preloading or for reloading in case of an error.
17382   * @api
17383   */
17384  load() {
17385    (this.state == rt.IDLE || this.state == rt.ERROR) && (this.state = rt.LOADING, this.changed(), this.imageLoadFunction_(this, this.src_), this.unlisten_ = Qh(
17386      this.image_,
17387      this.handleImageLoad_.bind(this),
17388      this.handleImageError_.bind(this)
17389    ));
17390  }
17391  /**
17392   * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
17393   */
17394  setImage(t) {
17395    this.image_ = t, this.resolution = Yt(this.extent) / this.image_.height;
17396  }
17397  /**
17398   * Discards event handlers which listen for load completion or errors.
17399   *
17400   * @private
17401   */
17402  unlistenImage_() {
17403    this.unlisten_ && (this.unlisten_(), this.unlisten_ = null);
17404  }
17405}
17406function Qh(e, t, i) {
17407  const s = (
17408    /** @type {HTMLImageElement} */
17409    e
17410  );
17411  let n = !0, r = !1, o = !1;
17412  const a = [
17413    Ao(s, et.LOAD, function() {
17414      o = !0, r || t();
17415    })
17416  ];
17417  return s.src && mE ? (r = !0, s.decode().then(function() {
17418    n && t();
17419  }).catch(function(l) {
17420    n && (o ? t() : i());
17421  })) : a.push(Ao(s, et.ERROR, i)), function() {
17422    n = !1, a.forEach(Mt);
17423  };
17424}
17425const DC = kC;
17426let Nn = null;
17427class NC extends Ar {
17428  /**
17429   * @param {HTMLImageElement|HTMLCanvasElement} image Image.
17430   * @param {string|undefined} src Src.
17431   * @param {import("../size.js").Size} size Size.
17432   * @param {?string} crossOrigin Cross origin.
17433   * @param {import("../ImageState.js").default} imageState Image state.
17434   * @param {import("../color.js").Color} color Color.
17435   */
17436  constructor(t, i, s, n, r, o) {
17437    super(), this.hitDetectionImage_ = null, this.image_ = t, this.crossOrigin_ = n, this.canvas_ = {}, this.color_ = o, this.unlisten_ = null, this.imageState_ = r, this.size_ = s, this.src_ = i, this.tainted_;
17438  }
17439  /**
17440   * @private
17441   */
17442  initializeImage_() {
17443    this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_);
17444  }
17445  /**
17446   * @private
17447   * @return {boolean} The image canvas is tainted.
17448   */
17449  isTainted_() {
17450    if (this.tainted_ === void 0 && this.imageState_ === rt.LOADED) {
17451      Nn || (Nn = re(1, 1, void 0, {
17452        willReadFrequently: !0
17453      })), Nn.drawImage(this.image_, 0, 0);
17454      try {
17455        Nn.getImageData(0, 0, 1, 1), this.tainted_ = !1;
17456      } catch {
17457        Nn = null, this.tainted_ = !0;
17458      }
17459    }
17460    return this.tainted_ === !0;
17461  }
17462  /**
17463   * @private
17464   */
17465  dispatchChangeEvent_() {
17466    this.dispatchEvent(et.CHANGE);
17467  }
17468  /**
17469   * @private
17470   */
17471  handleImageError_() {
17472    this.imageState_ = rt.ERROR, this.unlistenImage_(), this.dispatchChangeEvent_();
17473  }
17474  /**
17475   * @private
17476   */
17477  handleImageLoad_() {
17478    this.imageState_ = rt.LOADED, this.size_ ? (this.image_.width = this.size_[0], this.image_.height = this.size_[1]) : this.size_ = [this.image_.width, this.image_.height], this.unlistenImage_(), this.dispatchChangeEvent_();
17479  }
17480  /**
17481   * @param {number} pixelRatio Pixel ratio.
17482   * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
17483   */
17484  getImage(t) {
17485    return this.image_ || this.initializeImage_(), this.replaceColor_(t), this.canvas_[t] ? this.canvas_[t] : this.image_;
17486  }
17487  /**
17488   * @param {number} pixelRatio Pixel ratio.
17489   * @return {number} Image or Canvas element.
17490   */
17491  getPixelRatio(t) {
17492    return this.replaceColor_(t), this.canvas_[t] ? t : 1;
17493  }
17494  /**
17495   * @return {import("../ImageState.js").default} Image state.
17496   */
17497  getImageState() {
17498    return this.imageState_;
17499  }
17500  /**
17501   * @return {HTMLImageElement|HTMLCanvasElement} Image element.
17502   */
17503  getHitDetectionImage() {
17504    if (this.image_ || this.initializeImage_(), !this.hitDetectionImage_)
17505      if (this.isTainted_()) {
17506        const t = this.size_[0], i = this.size_[1], s = re(t, i);
17507        s.fillRect(0, 0, t, i), this.hitDetectionImage_ = s.canvas;
17508      } else
17509        this.hitDetectionImage_ = this.image_;
17510    return this.hitDetectionImage_;
17511  }
17512  /**
17513   * Get the size of the icon (in pixels).
17514   * @return {import("../size.js").Size} Image size.
17515   */
17516  getSize() {
17517    return this.size_;
17518  }
17519  /**
17520   * @return {string|undefined} Image src.
17521   */
17522  getSrc() {
17523    return this.src_;
17524  }
17525  /**
17526   * Load not yet loaded URI.
17527   */
17528  load() {
17529    if (this.imageState_ === rt.IDLE) {
17530      this.image_ || this.initializeImage_(), this.imageState_ = rt.LOADING;
17531      try {
17532        this.image_.src = this.src_;
17533      } catch {
17534        this.handleImageError_();
17535      }
17536      this.unlisten_ = Qh(
17537        this.image_,
17538        this.handleImageLoad_.bind(this),
17539        this.handleImageError_.bind(this)
17540      );
17541    }
17542  }
17543  /**
17544   * @param {number} pixelRatio Pixel ratio.
17545   * @private
17546   */
17547  replaceColor_(t) {
17548    if (!this.color_ || this.canvas_[t] || this.imageState_ !== rt.LOADED)
17549      return;
17550    const i = this.image_, s = document.createElement("canvas");
17551    s.width = Math.ceil(i.width * t), s.height = Math.ceil(i.height * t);
17552    const n = s.getContext("2d");
17553    n.scale(t, t), n.drawImage(i, 0, 0), n.globalCompositeOperation = "multiply", n.fillStyle = Hf(this.color_), n.fillRect(0, 0, s.width / t, s.height / t), n.globalCompositeOperation = "destination-in", n.drawImage(i, 0, 0), this.canvas_[t] = s;
17554  }
17555  /**
17556   * Discards event handlers which listen for load completion or errors.
17557   *
17558   * @private
17559   */
17560  unlistenImage_() {
17561    this.unlisten_ && (this.unlisten_(), this.unlisten_ = null);
17562  }
17563}
17564function GC(e, t, i, s, n, r) {
17565  let o = Oo.get(t, s, r);
17566  return o || (o = new NC(e, t, i, s, n, r), Oo.set(t, s, r, o)), o;
17567}
17568function Gu(e, t, i, s) {
17569  return i !== void 0 && s !== void 0 ? [i / e, s / t] : i !== void 0 ? i / e : s !== void 0 ? s / t : 1;
17570}
17571class tc extends Sg {
17572  /**
17573   * @param {Options} [options] Options.
17574   */
17575  constructor(t) {
17576    t = t || {};
17577    const i = t.opacity !== void 0 ? t.opacity : 1, s = t.rotation !== void 0 ? t.rotation : 0, n = t.scale !== void 0 ? t.scale : 1, r = t.rotateWithView !== void 0 ? t.rotateWithView : !1;
17578    super({
17579      opacity: i,
17580      rotation: s,
17581      scale: n,
17582      displacement: t.displacement !== void 0 ? t.displacement : [0, 0],
17583      rotateWithView: r,
17584      declutterMode: t.declutterMode
17585    }), this.anchor_ = t.anchor !== void 0 ? t.anchor : [0.5, 0.5], this.normalizedAnchor_ = null, this.anchorOrigin_ = t.anchorOrigin !== void 0 ? t.anchorOrigin : "top-left", this.anchorXUnits_ = t.anchorXUnits !== void 0 ? t.anchorXUnits : "fraction", this.anchorYUnits_ = t.anchorYUnits !== void 0 ? t.anchorYUnits : "fraction", this.crossOrigin_ = t.crossOrigin !== void 0 ? t.crossOrigin : null;
17586    const o = t.img !== void 0 ? t.img : null;
17587    this.imgSize_ = t.imgSize;
17588    let a = t.src;
17589    at(!(a !== void 0 && o), 4), at(!o || o && this.imgSize_, 5), (a === void 0 || a.length === 0) && o && (a = /** @type {HTMLImageElement} */
17590    o.src || ot(o)), at(a !== void 0 && a.length > 0, 6), at(
17591      !((t.width !== void 0 || t.height !== void 0) && t.scale !== void 0),
17592      69
17593    );
17594    const l = t.src !== void 0 ? rt.IDLE : rt.LOADED;
17595    if (this.color_ = t.color !== void 0 ? Lo(t.color) : null, this.iconImage_ = GC(
17596      o,
17597      /** @type {string} */
17598      a,
17599      this.imgSize_ !== void 0 ? this.imgSize_ : null,
17600      this.crossOrigin_,
17601      l,
17602      this.color_
17603    ), this.offset_ = t.offset !== void 0 ? t.offset : [0, 0], this.offsetOrigin_ = t.offsetOrigin !== void 0 ? t.offsetOrigin : "top-left", this.origin_ = null, this.size_ = t.size !== void 0 ? t.size : null, t.width !== void 0 || t.height !== void 0) {
17604      let h, c;
17605      if (t.size)
17606        [h, c] = t.size;
17607      else {
17608        const u = this.getImage(1);
17609        if (u instanceof HTMLCanvasElement || u.src && u.complete)
17610          h = u.width, c = u.height;
17611        else {
17612          this.initialOptions_ = t;
17613          const d = () => {
17614            if (this.unlistenImageChange(d), !this.initialOptions_)
17615              return;
17616            const f = this.iconImage_.getSize();
17617            this.setScale(
17618              Gu(
17619                f[0],
17620                f[1],
17621                t.width,
17622                t.height
17623              )
17624            );
17625          };
17626          this.listenImageChange(d);
17627          return;
17628        }
17629      }
17630      h !== void 0 && this.setScale(
17631        Gu(h, c, t.width, t.height)
17632      );
17633    }
17634  }
17635  /**
17636   * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
17637   * @return {Icon} The cloned style.
17638   * @api
17639   */
17640  clone() {
17641    let t, i, s;
17642    return this.initialOptions_ ? (i = this.initialOptions_.width, s = this.initialOptions_.height) : (t = this.getScale(), t = Array.isArray(t) ? t.slice() : t), new tc({
17643      anchor: this.anchor_.slice(),
17644      anchorOrigin: this.anchorOrigin_,
17645      anchorXUnits: this.anchorXUnits_,
17646      anchorYUnits: this.anchorYUnits_,
17647      color: this.color_ && this.color_.slice ? this.color_.slice() : this.color_ || void 0,
17648      crossOrigin: this.crossOrigin_,
17649      imgSize: this.imgSize_,
17650      offset: this.offset_.slice(),
17651      offsetOrigin: this.offsetOrigin_,
17652      opacity: this.getOpacity(),
17653      rotateWithView: this.getRotateWithView(),
17654      rotation: this.getRotation(),
17655      scale: t,
17656      width: i,
17657      height: s,
17658      size: this.size_ !== null ? this.size_.slice() : void 0,
17659      src: this.getSrc(),
17660      displacement: this.getDisplacement().slice(),
17661      declutterMode: this.getDeclutterMode()
17662    });
17663  }
17664  /**
17665   * Get the anchor point in pixels. The anchor determines the center point for the
17666   * symbolizer.
17667   * @return {Array<number>} Anchor.
17668   * @api
17669   */
17670  getAnchor() {
17671    let t = this.normalizedAnchor_;
17672    if (!t) {
17673      t = this.anchor_;
17674      const n = this.getSize();
17675      if (this.anchorXUnits_ == "fraction" || this.anchorYUnits_ == "fraction") {
17676        if (!n)
17677          return null;
17678        t = this.anchor_.slice(), this.anchorXUnits_ == "fraction" && (t[0] *= n[0]), this.anchorYUnits_ == "fraction" && (t[1] *= n[1]);
17679      }
17680      if (this.anchorOrigin_ != "top-left") {
17681        if (!n)
17682          return null;
17683        t === this.anchor_ && (t = this.anchor_.slice()), (this.anchorOrigin_ == "top-right" || this.anchorOrigin_ == "bottom-right") && (t[0] = 
17683-t[0] + n[0]), (this.anchorOrigin_ == "bottom-left" || this.anchorOrigin_ == "bottom-right") && (t[1] = -t[1] + n[1]);
17684      }
17685      this.normalizedAnchor_ = t;
17686    }
17687    const i = this.getDisplacement(), s = this.getScaleArray();
17688    return [
17689      t[0] - i[0] / s[0],
17690      t[1] + i[1] / s[1]
17691    ];
17692  }
17693  /**
17694   * Set the anchor point. The anchor determines the center point for the
17695   * symbolizer.
17696   *
17697   * @param {Array<number>} anchor Anchor.
17698   * @api
17699   */
17700  setAnchor(t) {
17701    this.anchor_ = t, this.normalizedAnchor_ = null;
17702  }
17703  /**
17704   * Get the icon color.
17705   * @return {import("../color.js").Color} Color.
17706   * @api
17707   */
17708  getColor() {
17709    return this.color_;
17710  }
17711  /**
17712   * Get the image icon.
17713   * @param {number} pixelRatio Pixel ratio.
17714   * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
17715   * @api
17716   */
17717  getImage(t) {
17718    return this.iconImage_.getImage(t);
17719  }
17720  /**
17721   * Get the pixel ratio.
17722   * @param {number} pixelRatio Pixel ratio.
17723   * @return {number} The pixel ratio of the image.
17724   * @api
17725   */
17726  getPixelRatio(t) {
17727    return this.iconImage_.getPixelRatio(t);
17728  }
17729  /**
17730   * @return {import("../size.js").Size} Image size.
17731   */
17732  getImageSize() {
17733    return this.iconImage_.getSize();
17734  }
17735  /**
17736   * @return {import("../ImageState.js").default} Image state.
17737   */
17738  getImageState() {
17739    return this.iconImage_.getImageState();
17740  }
17741  /**
17742   * @return {HTMLImageElement|HTMLCanvasElement} Image element.
17743   */
17744  getHitDetectionImage() {
17745    return this.iconImage_.getHitDetectionImage();
17746  }
17747  /**
17748   * Get the origin of the symbolizer.
17749   * @return {Array<number>} Origin.
17750   * @api
17751   */
17752  getOrigin() {
17753    if (this.origin_)
17754      return this.origin_;
17755    let t = this.offset_;
17756    if (this.offsetOrigin_ != "top-left") {
17757      const i = this.getSize(), s = this.iconImage_.getSize();
17758      if (!i || !s)
17759        return null;
17760      t = t.slice(), (this.offsetOrigin_ == "top-right" || this.offsetOrigin_ == "bottom-right") && (t[0] = s[0] - i[0] - t[0]), (this.offsetOrigin_ == "bottom-left" || this.offsetOrigin_ == "bottom-right") && (t[1] = s[1] - i[1] - t[1]);
17761    }
17762    return this.origin_ = t, this.origin_;
17763  }
17764  /**
17765   * Get the image URL.
17766   * @return {string|undefined} Image src.
17767   * @api
17768   */
17769  getSrc() {
17770    return this.iconImage_.getSrc();
17771  }
17772  /**
17773   * Get the size of the icon (in pixels).
17774   * @return {import("../size.js").Size} Image size.
17775   * @api
17776   */
17777  getSize() {
17778    return this.size_ ? this.size_ : this.iconImage_.getSize();
17779  }
17780  /**
17781   * Get the width of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
17782   * @return {number} Icon width (in pixels).
17783   * @api
17784   */
17785  getWidth() {
17786    const t = this.getScaleArray();
17787    if (this.size_)
17788      return this.size_[0] * t[0];
17789    if (this.iconImage_.getImageState() == rt.LOADED)
17790      return this.iconImage_.getSize()[0] * t[0];
17791  }
17792  /**
17793   * Get the height of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
17794   * @return {number} Icon height (in pixels).
17795   * @api
17796   */
17797  getHeight() {
17798    const t = this.getScaleArray();
17799    if (this.size_)
17800      return this.size_[1] * t[1];
17801    if (this.iconImage_.getImageState() == rt.LOADED)
17802      return this.iconImage_.getSize()[1] * t[1];
17803  }
17804  /**
17805   * Set the scale.
17806   *
17807   * @param {number|import("../size.js").Size} scale Scale.
17808   * @api
17809   */
17810  setScale(t) {
17811    delete this.initialOptions_, super.setScale(t);
17812  }
17813  /**
17814   * @param {function(import("../events/Event.js").default): void} listener Listener function.
17815   */
17816  listenImageChange(t) {
17817    this.iconImage_.addEventListener(et.CHANGE, t);
17818  }
17819  /**
17820   * Load not yet loaded URI.
17821   * When rendering a feature with an icon style, the vector renderer will
17822   * automatically call this method. However, you might want to call this
17823   * method yourself for preloading or other purposes.
17824   * @api
17825   */
17826  load() {
17827    this.iconImage_.load();
17828  }
17829  /**
17830   * @param {function(import("../events/Event.js").default): void} listener Listener function.
17831   */
17832  unlistenImageChange(t) {
17833    this.iconImage_.removeEventListener(et.CHANGE, t);
17834  }
17835}
17836const Lg = tc;
17837function zu(e) {
17838  return new pr({
17839    fill: yr(e, ""),
17840    stroke: xr(e, ""),
17841    text: zC(e),
17842    image: jC(e)
17843  });
17844}
17845function yr(e, t) {
17846  const i = e[t + "fill-color"];
17847  if (i)
17848    return new Mi({ color: i });
17849}
17850function xr(e, t) {
17851  const i = e[t + "stroke-width"], s = e[t + "stroke-color"];
17852  if (!(!i && !s))
17853    return new vi({
17854      width: i,
17855      color: s,
17856      lineCap: e[t + "stroke-line-cap"],
17857      lineJoin: e[t + "stroke-line-join"],
17858      lineDash: e[t + "stroke-line-dash"],
17859      lineDashOffset: e[t + "stroke-line-dash-offset"],
17860      miterLimit: e[t + "stroke-miter-limit"]
17861    });
17862}
17863function zC(e) {
17864  const t = e["text-value"];
17865  return t ? new SC({
17866    text: t,
17867    font: e["text-font"],
17868    maxAngle: e["text-max-angle"],
17869    offsetX: e["text-offset-x"],
17870    offsetY: e["text-offset-y"],
17871    overflow: e["text-overflow"],
17872    placement: e["text-placement"],
17873    repeat: e["text-repeat"],
17874    scale: e["text-scale"],
17875    rotateWithView: e["text-rotate-with-view"],
17876    rotation: e["text-rotation"],
17877    textAlign: e["text-align"],
17878    justify: e["text-justify"],
17879    textBaseline: e["text-baseline"],
17880    padding: e["text-padding"],
17881    fill: yr(e, "text-"),
17882    backgroundFill: yr(e, "text-background-"),
17883    stroke: xr(e, "text-"),
17884    backgroundStroke: xr(e, "text-background-")
17885  }) : void 0;
17886}
17887function jC(e) {
17888  const t = e["icon-src"], i = e["icon-img"];
17889  if (t || i)
17890    return new Lg({
17891      src: t,
17892      img: i,
17893      imgSize: e["icon-img-size"],
17894      anchor: e["icon-anchor"],
17895      anchorOrigin: e["icon-anchor-origin"],
17896      anchorXUnits: e["icon-anchor-x-units"],
17897      anchorYUnits: e["icon-anchor-y-units"],
17898      color: e["icon-color"],
17899      crossOrigin: e["icon-cross-origin"],
17900      offset: e["icon-offset"],
17901      displacement: e["icon-displacement"],
17902      opacity: e["icon-opacity"],
17903      scale: e["icon-scale"],
17904      width: e["icon-width"],
17905      height: e["icon-height"],
17906      rotation: e["icon-rotation"],
17907      rotateWithView: e["icon-rotate-with-view"],
17908      size: e["icon-size"],
17909      declutterMode: e["icon-declutter-mode"]
17910    });
17911  const s = e["shape-points"];
17912  if (s) {
17913    const r = "shape-";
17914    return new Tg({
17915      points: s,
17916      fill: yr(e, r),
17917      stroke: xr(e, r),
17918      radius: e["shape-radius"],
17919      radius1: e["shape-radius1"],
17920      radius2: e["shape-radius2"],
17921      angle: e["shape-angle"],
17922      displacement: e["shape-displacement"],
17923      rotation: e["shape-rotation"],
17924      rotateWithView: e["shape-rotate-with-view"],
17925      scale: e["shape-scale"],
17926      declutterMode: e["shape-declutter-mode"]
17927    });
17928  }
17929  const n = e["circle-radius"];
17930  if (n) {
17931    const r = "circle-";
17932    return new Fr({
17933      radius: n,
17934      fill: yr(e, r),
17935      stroke: xr(e, r),
17936      displacement: e["circle-displacement"],
17937      scale: e["circle-scale"],
17938      rotation: e["circle-rotation"],
17939      rotateWithView: e["circle-rotate-with-view"],
17940      declutterMode: e["circle-declutter-mode"]
17941    });
17942  }
17943}
17944const ju = {
17945  RENDER_ORDER: "renderOrder"
17946};
17947class WC extends Lr {
17948  /**
17949   * @param {Options<VectorSourceType>} [options] Options.
17950   */
17951  constructor(t) {
17952    t = t || {};
17953    const i = Object.assign({}, t);
17954    delete i.style, delete i.renderBuffer, delete i.updateWhileAnimating, delete i.updateWhileInteracting, super(i), this.declutter_ = t.declutter !== void 0 ? t.declutter : !1, this.renderBuffer_ = t.renderBuffer !== void 0 ? t.renderBuffer : 100, this.style_ = null, this.styleFunction_ = void 0, this.setStyle(t.style), this.updateWhileAnimating_ = t.updateWhileAnimating !== void 0 ? t.updateWhileAnimating : !1, this.updateWhileInteracting_ = t.updateWhileInteracting !== void 0 ? t.updateWhileInteracting : !1;
17955  }
17956  /**
17957   * @return {boolean} Declutter.
17958   */
17959  getDeclutter() {
17960    return this.declutter_;
17961  }
17962  /**
17963   * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
17964   * that resolves with an array of features. The array will either contain the topmost feature
17965   * when a hit was detected, or it will be empty.
17966   *
17967   * The hit detection algorithm used for this method is optimized for performance, but is less
17968   * accurate than the one used in [map.getFeaturesAtPixel()]{@link import("../Map.js").default#getFeaturesAtPixel}.
17969   * Text is not considered, and icons are only represented by their bounding box instead of the exact
17970   * image.
17971   *
17972   * @param {import("../pixel.js").Pixel} pixel Pixel.
17973   * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with an array of features.
17974   * @api
17975   */
17976  getFeatures(t) {
17977    return super.getFeatures(t);
17978  }
17979  /**
17980   * @return {number|undefined} Render buffer.
17981   */
17982  getRenderBuffer() {
17983    return this.renderBuffer_;
17984  }
17985  /**
17986   * @return {function(import("../Feature.js").default, import("../Feature.js").default): number|null|undefined} Render
17987   *     order.
17988   */
17989  getRenderOrder() {
17990    return (
17991      /** @type {import("../render.js").OrderFunction|null|undefined} */
17992      this.get(ju.RENDER_ORDER)
17993    );
17994  }
17995  /**
17996   * Get the style for features.  This returns whatever was passed to the `style`
17997   * option at construction or to the `setStyle` method.
17998   * @return {import("../style/Style.js").StyleLike|null|undefined} Layer style.
17999   * @api
18000   */
18001  getStyle() {
18002    return this.style_;
18003  }
18004  /**
18005   * Get the style function.
18006   * @return {import("../style/Style.js").StyleFunction|undefined} Layer style function.
18007   * @api
18008   */
18009  getStyleFunction() {
18010    return this.styleFunction_;
18011  }
18012  /**
18013   * @return {boolean} Whether the rendered layer should be updated while
18014   *     animating.
18015   */
18016  getUpdateWhileAnimating() {
18017    return this.updateWhileAnimating_;
18018  }
18019  /**
18020   * @return {boolean} Whether the rendered layer should be updated while
18021   *     interacting.
18022   */
18023  getUpdateWhileInteracting() {
18024    return this.updateWhileInteracting_;
18025  }
18026  /**
18027   * Render declutter items for this layer
18028   * @param {import("../Map.js").FrameState} frameState Frame state.
18029   */
18030  renderDeclutter(t) {
18031    t.declutterTree || (t.declutterTree = new Pg(9)), this.getRenderer().renderDeclutter(t);
18032  }
18033  /**
18034   * @param {import("../render.js").OrderFunction|null|undefined} renderOrder
18035   *     Render order.
18036   */
18037  setRenderOrder(t) {
18038    this.set(ju.RENDER_ORDER, t);
18039  }
18040  /**
18041   * Set the style for features.  This can be a single style object, an array
18042   * of styles, or a function that takes a feature and resolution and returns
18043   * an array of styles. If set to `null`, the layer has no style (a `null` style),
18044   * so only features that have their own styles will be rendered in the layer. C
18044all
18045   * `setStyle()` without arguments to reset to the default style. See
18046   * [the ol/style/Style module]{@link module:ol/style/Style~Style} for information on the default style.
18047   *
18048   * If your layer has a static style, you can use [flat style]{@link module:ol/style/flat~FlatStyle} object
18049   * literals instead of using the `Style` and symbolizer constructors (`Fill`, `Stroke`, etc.):
18050   * ```js
18051   * vectorLayer.setStyle({
18052   *   "fill-color": "yellow",
18053   *   "stroke-color": "black",
18054   *   "stroke-width": 4
18055   * })
18056   * ```
18057   *
18058   * @param {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [style] Layer style.
18059   * @api
18060   */
18061  setStyle(t) {
18062    let i;
18063    if (t === void 0)
18064      i = bC;
18065    else if (t === null)
18066      i = null;
18067    else if (typeof t == "function")
18068      i = t;
18069    else if (t instanceof pr)
18070      i = t;
18071    else if (Array.isArray(t)) {
18072      const s = t.length, n = new Array(s);
18073      for (let r = 0; r < s; ++r) {
18074        const o = t[r];
18075        o instanceof pr ? n[r] = o : n[r] = zu(o);
18076      }
18077      i = n;
18078    } else
18079      i = zu(t);
18080    this.style_ = i, this.styleFunction_ = t === null ? void 0 : CC(this.style_), this.changed();
18081  }
18082}
18083const BC = WC, kr = {
18084  BEGIN_GEOMETRY: 0,
18085  BEGIN_PATH: 1,
18086  CIRCLE: 2,
18087  CLOSE_PATH: 3,
18088  CUSTOM: 4,
18089  DRAW_CHARS: 5,
18090  DRAW_IMAGE: 6,
18091  END_GEOMETRY: 7,
18092  FILL: 8,
18093  MOVE_TO_LINE_TO: 9,
18094  SET_FILL_STYLE: 10,
18095  SET_STROKE_STYLE: 11,
18096  STROKE: 12
18097}, eo = [kr.FILL], Bi = [kr.STROKE], fs = [kr.BEGIN_PATH], Wu = [kr.CLOSE_PATH], Q = kr;
18098class UC {
18099  /**
18100   * Render a geometry with a custom renderer.
18101   *
18102   * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
18103   * @param {import("../Feature.js").FeatureLike} feature Feature.
18104   * @param {Function} renderer Renderer.
18105   * @param {Function} hitDetectionRenderer Renderer.
18106   */
18107  drawCustom(t, i, s, n) {
18108  }
18109  /**
18110   * Render a geometry.
18111   *
18112   * @param {import("../geom/Geometry.js").default} geometry The geometry to render.
18113   */
18114  drawGeometry(t) {
18115  }
18116  /**
18117   * Set the rendering style.
18118   *
18119   * @param {import("../style/Style.js").default} style The rendering style.
18120   */
18121  setStyle(t) {
18122  }
18123  /**
18124   * @param {import("../geom/Circle.js").default} circleGeometry Circle geometry.
18125   * @param {import("../Feature.js").default} feature Feature.
18126   */
18127  drawCircle(t, i) {
18128  }
18129  /**
18130   * @param {import("../Feature.js").default} feature Feature.
18131   * @param {import("../style/Style.js").default} style Style.
18132   */
18133  drawFeature(t, i) {
18134  }
18135  /**
18136   * @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection.
18137   * @param {import("../Feature.js").default} feature Feature.
18138   */
18139  drawGeometryCollection(t, i) {
18140  }
18141  /**
18142   * @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry.
18143   * @param {import("../Feature.js").FeatureLike} feature Feature.
18144   */
18145  drawLineString(t, i) {
18146  }
18147  /**
18148   * @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry.
18149   * @param {import("../Feature.js").FeatureLike} feature Feature.
18150   */
18151  drawMultiLineString(t, i) {
18152  }
18153  /**
18154   * @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry.
18155   * @param {import("../Feature.js").FeatureLike} feature Feature.
18156   */
18157  drawMultiPoint(t, i) {
18158  }
18159  /**
18160   * @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
18161   * @param {import("../Feature.js").FeatureLike} feature Feature.
18162   */
18163  drawMultiPolygon(t, i) {
18164  }
18165  /**
18166   * @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry.
18167   * @param {import("../Feature.js").FeatureLike} feature Feature.
18168   */
18169  drawPoint(t, i) {
18170  }
18171  /**
18172   * @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry.
18173   * @param {import("../Feature.js").FeatureLike} feature Feature.
18174   */
18175  drawPolygon(t, i) {
18176  }
18177  /**
18178   * @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry.
18179   * @param {import("../Feature.js").FeatureLike} feature Feature.
18180   */
18181  drawText(t, i) {
18182  }
18183  /**
18184   * @param {import("../style/Fill.js").default} fillStyle Fill style.
18185   * @param {import("../style/Stroke.js").default} strokeStyle Stroke style.
18186   */
18187  setFillStrokeStyle(t, i) {
18188  }
18189  /**
18190   * @param {import("../style/Image.js").default} imageStyle Image style.
18191   * @param {import("../render/canvas.js").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with a text style.
18192   */
18193  setImageStyle(t, i) {
18194  }
18195  /**
18196   * @param {import("../style/Text.js").default} textStyle Text style.
18197   * @param {import("../render/canvas.js").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with an image style.
18198   */
18199  setTextStyle(t, i) {
18200  }
18201}
18202const Og = UC;
18203class XC extends Og {
18204  /**
18205   * @param {number} tolerance Tolerance.
18206   * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
18207   * @param {number} resolution Resolution.
18208   * @param {number} pixelRatio Pixel ratio.
18209   */
18210  constructor(t, i, s, n) {
18211    super(), this.tolerance = t, this.maxExtent = i, this.pixelRatio = n, this.maxLineWidth = 0, this.resolution = s, this.beginGeometryInstruction1_ = null, this.beginGeometryInstruction2_ = null, this.bufferedMaxExtent_ = null, this.instructions = [], this.coordinates = [], this.tmpCoordinate_ = [], this.hitDetectionInstructions = [], this.state = /** @type {import("../canvas.js").FillStrokeState} */
18212    {};
18213  }
18214  /**
18215   * @protected
18216   * @param {Array<number>} dashArray Dash array.
18217   * @return {Array<number>} Dash array with pixel ratio applied
18218   */
18219  applyPixelRatio(t) {
18220    const i = this.pixelRatio;
18221    return i == 1 ? t : t.map(function(s) {
18222      return s * i;
18223    });
18224  }
18225  /**
18226   * @param {Array<number>} flatCoordinates Flat coordinates.
18227   * @param {number} stride Stride.
18228   * @protected
18229   * @return {number} My end
18230   */
18231  appendFlatPointCoordinates(t, i) {
18232    const s = this.getBufferedMaxExtent(), n = this.tmpCoordinate_, r = this.coordinates;
18233    let o = r.length;
18234    for (let a = 0, l = t.length; a < l; a += i)
18235      n[0] = t[a], n[1] = t[a + 1], Rr(s, n) && (r[o++] = n[0], r[o++] = n[1]);
18236    return o;
18237  }
18238  /**
18239   * @param {Array<number>} flatCoordinates Flat coordinates.
18240   * @param {number} offset Offset.
18241   * @param {number} end End.
18242   * @param {number} stride Stride.
18243   * @param {boolean} closed Last input coordinate equals first.
18244   * @param {boolean} skipFirst Skip first coordinate.
18245   * @protected
18246   * @return {number} My end.
18247   */
18248  appendFlatLineCoordinates(t, i, s, n, r, o) {
18249    const a = this.coordinates;
18250    let l = a.length;
18251    const h = this.getBufferedMaxExtent();
18252    o && (i += n);
18253    let c = t[i], u = t[i + 1];
18254    const d = this.tmpCoordinate_;
18255    let f = !0, g, _, m;
18256    for (g = i + n; g < s; g += n)
18257      d[0] = t[g], d[1] = t[g + 1], m = ll(h, d), m !== _ ? (f && (a[l++] = c, a[l++] = u, f = !1), a[l++] = d[0], a[l++] = d[1]) : m === Ut.INTERSECTING ? (a[l++] = d[0], a[l++] = d[1], f = !1) : f = !0, c = d[0], u = d[1], _ = m;
18258    return (r && f || g === i + n) && (a[l++] = c, a[l++] = u), l;
18259  }
18260  /**
18261   * @param {Array<number>} flatCoordinates Flat coordinates.
18262   * @param {number} offset Offset.
18263   * @param {Array<number>} ends Ends.
18264   * @param {number} stride Stride.
18265   * @param {Array<number>} builderEnds Builder ends.
18266   * @return {number} Offset.
18267   */
18268  drawCustomCoordinates_(t, i, s, n, r) {
18269    for (let o = 0, a = s.length; o < a; ++o) {
18270      const l = s[o], h = this.appendFlatLineCoordinates(
18271        t,
18272        i,
18273        l,
18274        n,
18275        !1,
18276        !1
18277      );
18278      r.push(h), i = l;
18279    }
18280    return i;
18281  }
18282  /**
18283   * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
18284   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18285   * @param {Function} renderer Renderer.
18286   * @param {Function} hitDetectionRenderer Renderer.
18287   */
18288  drawCustom(t, i, s, n) {
18289    this.beginGeometry(t, i);
18290    const r = t.getType(), o = t.getStride(), a = this.coordinates.length;
18291    let l, h, c, u, d;
18292    switch (r) {
18293      case "MultiPolygon":
18294        l = /** @type {import("../../geom/MultiPolygon.js").default} */
18295        t.getOrientedFlatCoordinates(), u = [];
18296        const f = (
18297          /** @type {import("../../geom/MultiPolygon.js").default} */
18298          t.getEndss()
18299        );
18300        d = 0;
18301        for (let g = 0, _ = f.length; g < _; ++g) {
18302          const m = [];
18303          d = this.drawCustomCoordinates_(
18304            l,
18305            d,
18306            f[g],
18307            o,
18308            m
18309          ), u.push(m);
18310        }
18311        this.instructions.push([
18312          Q.CUSTOM,
18313          a,
18314          u,
18315          t,
18316          s,
18317          Tl
18318        ]), this.hitDetectionInstructions.push([
18319          Q.CUSTOM,
18320          a,
18321          u,
18322          t,
18323          n || s,
18324          Tl
18325        ]);
18326        break;
18327      case "Polygon":
18328      case "MultiLineString":
18329        c = [], l = r == "Polygon" ? (
18330          /** @type {import("../../geom/Polygon.js").default} */
18331          t.getOrientedFlatCoordinates()
18332        ) : t.getFlatCoordinates(), d = this.drawCustomCoordinates_(
18333          l,
18334          0,
18335          /** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */
18336          t.getEnds(),
18337          o,
18338          c
18339        ), this.instructions.push([
18340          Q.CUSTOM,
18341          a,
18342          c,
18343          t,
18344          s,
18345          cr
18346        ]), this.hitDetectionInstructions.push([
18347          Q.CUSTOM,
18348          a,
18349          c,
18350          t,
18351          n || s,
18352          cr
18353        ]);
18354        break;
18355      case "LineString":
18356      case "Circle":
18357        l = t.getFlatCoordinates(), h = this.appendFlatLineCoordinates(
18358          l,
18359          0,
18360          l.length,
18361          o,
18362          !1,
18363          !1
18364        ), this.instructions.push([
18365          Q.CUSTOM,
18366          a,
18367          h,
18368          t,
18369          s,
18370          ji
18371        ]), this.hitDetectionInstructions.push([
18372          Q.CUSTOM,
18373          a,
18374          h,
18375          t,
18376          n || s,
18377          ji
18378        ]);
18379        break;
18380      case "MultiPoint":
18381        l = t.getFlatCoordinates(), h = this.appendFlatPointCoordinates(l, o), h > a && (this.instructions.push([
18382          Q.CUSTOM,
18383          a,
18384          h,
18385          t,
18386          s,
18387          ji
18388        ]), this.hitDetectionInstructions.push([
18389          Q.CUSTOM,
18390          a,
18391          h,
18392          t,
18393          n || s,
18394          ji
18395        ]));
18396        break;
18397      case "Point":
18398        l = t.getFlatCoordinates(), this.coordinates.push(l[0], l[1]), h = this.coordinates.length, this.instructions.push([
18399          Q.CUSTOM,
18400          a,
18401          h,
18402          t,
18403          s
18404        ]), this.hitDetectionInstructions.push([
18405          Q.CUSTOM,
18406          a,
18407          h,
18408          t,
18409          n || s
18410        ]);
18411        break;
18412    }
18413    this.endGeometry(i);
18414  }
18415  /**
18416   * @protected
18417   * @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry.
18418   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18419   */
18420  beginGeometry(t, i) {
18421    this.beginGeometryInstruction1_ = [
18422      Q.BEGIN_GEOMETRY,
18423      i,
18424      0,
18425      t
18426    ], this.instructions.push(this.beginGeometryInstruction1_), this.beginGeometryInstruction2_ = [
18427      Q.BEGIN_GEOMETRY,
18428      i,
18429      0,
18430      t
18431    ], this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);
18432  }
18433  /**
18434   * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
18435   */
18436  finish() {
18437    return {
18438      instructions: this.instructions,
18439      hitDetectionInstructions: this.hitDetectionInstructions,
18440      coordinates: this.coordinates
18441    };
18442  }
18443  /**
18444   * Reverse the hit detection instructions.
18445   */
18446  reverseHitDetectionInstructions() {
18447    const t = this.hitDetectionInstructions;
18448    t.reverse();
18449    let i;
18450    const s = t.length;
18451    let n, r, o = -1;
18452    for (i = 0; i < s; ++i)
18453      n = t[i], r = /** @type {import("./Instruction.js").default} */
18454      n[0], r == Q.END_GEOMETRY ? o = i : r == Q.BEGIN_GEOMETRY && (n[2] = i, nE(this.hitDetectionInstructions, o, i), o = -1);
18455  }
18456  /**
18457   * @param {import("../../style/Fill.js").default} fillStyle Fill style.
18458   * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
18459   */
18460  setFillStrokeStyle(t, i) {
18461    const s = this.state;
18462    if (t) {
18463      const n = t.getColor();
18464      s.fillStyle = Ze(
18465        n || xi
18466      );
18467    } else
18468      s.fillStyle = void 0;
18469    if (i) {
18470      const n = i.getColor();
18471      s.strokeStyle = Ze(
18472        n || gr
18473      );
18474      const r = i.getLineCap();
18475      s.lineCap = r !== void 0 ? r : Do;
18476      const o = i.getLineDash();
18477      s.lineDash = o ? o.slice() : ur;
18478      const a = i.getLineDashOffset();
18479      s.lineDashOffset = a || dr;
18480      const l = i.getLineJoin();
18481      s.lineJoin = l !== void 0 ? l : wn;
18482      const h = i.getWidth();
18483      s.lineWidth = h !== void 0 ? h : mr;
18484      const c = i.getMiterLimit();
18485      s.miterLimit = c !== void 0 ? c : fr, s.lineWidth > this.maxLineWidth && (this.maxLineWidth = s.lineWidth, this.bufferedMaxExtent_ = null);
18486    } else
18487      s.strokeStyle = void 0, s.lineCap = void 0, s.lineDash = null, s.lineDashOffset = void 0, s.lineJoin = void 0, s.lineWidth = void 0, s.miterLimit = void 0;
18488  }
18489  /**
18490   * @param {import("../canvas.js").FillStrokeState} state State.
18491   * @return {Array<*>} Fill instruction.
18492   */
18493  createFill(t) {
18494    const i = t.fillStyle, s = [Q.SET_FILL_STYLE, i];
18495    return typeof i != "string" && s.push(!0), s;
18496  }
18497  /**
18498   * @param {import("../canvas.js").FillStrokeState} state State.
18499   */
18500  applyStroke(t) {
18501    this.instructions.push(this.createStroke(t));
18502  }
18503  /**
18504   * @param {import("../canvas.js").FillStrokeState} state State.
18505   * @return {Array<*>} Stroke instruction.
18506   */
18507  createStroke(t) {
18508    return [
18509      Q.SET_STROKE_STYLE,
18510      t.strokeStyle,
18511      t.lineWidth * this.pixelRatio,
18512      t.lineCap,
18513      t.lineJoin,
18514      t.miterLimit,
18515      this.applyPixelRatio(t.lineDash),
18516      t.lineDashOffset * this.pixelRatio
18517    ];
18518  }
18519  /**
18520   * @param {import("../canvas.js").FillStrokeState} state State.
18521   * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
18522   */
18523  updateFillStyle(t, i) {
18524    const s = t.fillStyle;
18525    (typeof s != "string" || t.currentFillStyle != s) && (s !== void 0 && this.instructions.push(i.call(this, t)), t.currentFillStyle = s);
18526  }
18527  /**
18528   * @param {import("../canvas.js").FillStrokeState} state State.
18529   * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke.
18530   */
18531  updateStrokeStyle(t, i) {
18532    const s = t.strokeStyle, n = t.lineCap, r = t.lineDash, o = t.lineDashOffset, a = t.lineJoin, l = t.lineWidth, h = t.miterLimit;
18533    (t.currentStrokeStyle != s || t.currentLineCap != n || r != t.currentLineDash && !wi(t.currentLineDash, r) || t.currentLineDashOffset != o || t.currentLineJoin != a || t.currentLineWidth != l || t.currentMiterLimit != h) && (s !== void 0 && i.call(this, t), t.currentStrokeStyle = s, t.currentLineCap = n, t.currentLineDash = r, t.currentLineDashOffset = o, t.currentLineJoin = a, t.currentLineWidth = l, t.currentMiterLimit = h);
18534  }
18535  /**
18536   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18537   */
18538  endGeometry(t) {
18539    this.beginGeometryInstruction1_[2] = this.instructions.length, this.beginGeometryInstruction1_ = null, this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length, this.beginGeometryInstruction2_ = null;
18540    const i = [Q.END_GEOMETRY, t];
18541    this.instructions.push(i), this.hitDetectionInstructions.push(i);
18542  }
18543  /**
18544   * Get the buffered rendering extent.  Rendering will be clipped to the extent
18545   * provided to the constructor.  To account for symbolizers that may intersect
18546   * this extent, we calculate a buffered extent (e.g. based on stroke width).
18547   * @return {import("../../extent.js").Extent} The buffered rendering extent.
18548   * @protected
18549   */
18550  getBufferedMaxExtent() {
18551    if (!this.bufferedMaxExtent_ && (this.bufferedMaxExtent_ = Gd(this.maxExtent), this.maxLineWidth > 0)) {
18552      const t = this.resolution * (this.maxLineWidth + 1) / 2;
18553      Ms(this.bufferedMaxExtent_, t, this.bufferedMaxExtent_);
18554    }
18555    return this.bufferedMaxExtent_;
18556  }
18557}
18558const Dr = XC;
18559class $C extends Dr {
18560  /**
18561   * @param {number} tolerance Tolerance.
18562   * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
18563   * @param {number} resolution Resolution.
18564   * @param {number} pixelRatio Pixel ratio.
18565   */
18566  constructor(t, i, s, n) {
18567    super(t, i, s, n), this.hitDetectionImage_ = null, this.image_ = null, this.imagePixelRatio_ = void 0, this.anchorX_ = void 0, this.anchorY_ = void 0, this.height_ = void 0, this.opacity_ = void 0, this.originX_ = void 0, this.originY_ = void 0, this.rotateWithView_ = void 0, this.rotation_ = void 0, this.scale_ = void 0, this.width_ = void 0, this.declutterMode_ = void 0, this.declutterImageWithText_ = void 0;
18568  }
18569  /**
18570   * @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry.
18571   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18572   */
18573  drawPoint(t, i) {
18574    if (!this.image_)
18575      return;
18576    this.beginGeometry(t, i);
18577    const s = t.getFlatCoordinates(), n = t.getStride(), r = this.coordinates.length, o = this.appendFlatPointCoordinates(s, n);
18578    this.instructions.push([
18579      Q.DRAW_IMAGE,
18580      r,
18581      o,
18582      this.image_,
18583      // Remaining arguments to DRAW_IMAGE are in alphabetical order
18584      this.anchorX_ * this.imagePixelRatio_,
18585      this.anchorY_ * this.imagePixelRatio_,
18586      Math.ceil(this.height_ * this.imagePixelRatio_),
18587      this.opacity_,
18588      this.originX_ * this.imagePixelRatio_,
18589      this.originY_ * this.imagePixelRatio_,
18590      this.rotateWithView_,
18591      this.rotation_,
18592      [
18593        this.scale_[0] * this.pixelRatio / this.imagePixelRatio_,
18594        this.scale_[1] * this.pixelRatio / this.imagePixelRatio_
18595      ],
18596      Math.ceil(this.width_ * this.imagePixelRatio_),
18597      this.declutterMode_,
18598      this.declutterImageWithText_
18599    ]), this.hitDetectionInstructions.push([
18600      Q.DRAW_IMAGE,
18601      r,
18602      o,
18603      this.hitDetectionImage_,
18604      // Remaining arguments to DRAW_IMAGE are in alphabetical order
18605      this.anchorX_,
18606      this.anchorY_,
18607      this.height_,
18608      this.opacity_,
18609      this.originX_,
18610      this.originY_,
18611      this.rotateWithView_,
18612      this.rotation_,
18613      this.scale_,
18614      this.width_,
18615      this.declutterMode_,
18616      this.declutterImageWithText_
18617    ]), this.endGeometry(i);
18618  }
18619  /**
18620   * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry.
18621   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18622   */
18623  drawMultiPoint(t, i) {
18624    if (!this.image_)
18625      return;
18626    this.beginGeometry(t, i);
18627    const s = t.getFlatCoordinates(), n = t.getStride(), r = this.coordinates.length, o = this.appendFlatPointCoordinates(s, n);
18628    this.instructions.push([
18629      Q.DRAW_IMAGE,
18630      r,
18631      o,
18632      this.image_,
18633      // Remaining arguments to DRAW_IMAGE are in alphabetical order
18634      this.anchorX_ * this.imagePixelRatio_,
18635      this.anchorY_ * this.imagePixelRatio_,
18636      Math.ceil(this.height_ * this.imagePixelRatio_),
18637      this.opacity_,
18638      this.originX_ * this.imagePixelRatio_,
18639      this.originY_ * this.imagePixelRatio_,
18640      this.rotateWithView_,
18641      this.rotation_,
18642      [
18643        this.scale_[0] * this.pixelRatio / this.imagePixelRatio_,
18644        this.scale_[1] * this.pixelRatio / this.imagePixelRatio_
18645      ],
18646      Math.ceil(this.width_ * this.imagePixelRatio_),
18647      this.declutterMode_,
18648      this.declutterImageWithText_
18649    ]), this.hitDetectionInstructions.push([
18650      Q.DRAW_IMAGE,
18651      r,
18652      o,
18653      this.hitDetectionImage_,
18654      // Remaining arguments to DRAW_IMAGE are in alphabetical order
18655      this.anchorX_,
18656      this.anchorY_,
18657      this.height_,
18658      this.opacity_,
18659      this.originX_,
18660      this.originY_,
18661      this.rotateWithView_,
18662      this.rotation_,
18663      this.scale_,
18664      this.width_,
18665      this.declutterMode_,
18666      this.declutterImageWithText_
18667    ]), this.endGeometry(i);
18668  }
18669  /**
18670   * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
18671   */
18672  finish() {
18673    return this.reverseHitDetectionInstructions(), this.anchorX_ = void 0, this.anchorY_ = void 0, this.hitDetectionImage_ = null, this.image_ = null, this.imagePixelRatio_ = void 0, this.height_ = void 0, this.scale_ = void 0, this.opacity_ = void 0, this.originX_ = void 0, this.originY_ = void 0, this.rotateWithView_ = void 0, this.rotation_ = void 0, this.width_ = void 0, super.finish();
18674  }
18675  /**
18676   * @param {import("../../style/Image.js").default} imageStyle Image style.
18677   * @param {Object} [sharedData] Shared data.
18678   */
18679  setImageStyle(t, i) {
18680    const s = t.getAnchor(), n = t.getSize(), r = t.getOrigin();
18681    this.imagePixelRatio_ = t.getPixelRatio(this.pixelRatio), this.anchorX_ = s[0], this.anchorY_ = s[1], this.hitDetectionImage_ = t.getHitDetectionImage(), this.image_ = t.getImage(this.pixelRatio), this.height_ = n[1], this.opacity_ = t.getOpacity(), this.originX_ = r[0], this.originY_ = r[1], this.rotateWithView_ = t.getRotateWithView(), this.rotation_ = t.getRotation(), this.scale_ = t.getScaleArray(), this.width_ = n[0], this.declutterMode_ = t.getDeclutterMode(), this.declutterImageWithText_ = i;
18682  }
18683}
18684const YC = $C;
18685class KC extends Dr {
18686  /**
18687   * @param {number} tolerance Tolerance.
18688   * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
18689   * @param {number} resolution Resolution.
18690   * @param {number} pixelRatio Pixel ratio.
18691   */
18692  constructor(t, i, s, n) {
18693    super(t, i, s, n);
18694  }
18695  /**
18696   * @param {Array<number>} flatCoordinates Flat coordinates.
18697   * @param {number} offset Offset.
18698   * @param {number} end End.
18699   * @param {number} stride Stride.
18700   * @private
18701   * @return {number} end.
18702   */
18703  drawFlatCoordinates_(t, i, s, n) {
18704    const r = this.coordinates.length, o = this.appendFlatLineCoordinates(
18705      t,
18706      i,
18707      s,
18708      n,
18709      !1,
18710      !1
18711    ), a = [
18712      Q.MOVE_TO_LINE_TO,
18713      r,
18714      o
18715    ];
18716    return this.instructions.push(a), this.hitDetectionInstructions.push(a), s;
18717  }
18718  /**
18719   * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry.
18720   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18721   */
18722  drawLineString(t, i) {
18723    const s = this.state, n = s.strokeStyle, r = s.lineWidth;
18724    if (n === void 0 || r === void 0)
18725      return;
18726    this.updateStrokeStyle(s, this.applyStroke), this.beginGeometry(t, i), this.hitDetectionInstructions.push(
18727      [
18728        Q.SET_STROKE_STYLE,
18729        s.strokeStyle,
18730        s.lineWidth,
18731        s.lineCap,
18732        s.lineJoin,
18733        s.miterLimit,
18734        ur,
18735        dr
18736      ],
18737      fs
18738    );
18739    const o = t.getFlatCoordinates(), a = t.getStride();
18740    this.drawFlatCoordinates_(
18741      o,
18742      0,
18743      o.length,
18744      a
18745    ), this.hitDetectionInstructions.push(Bi), this.endGeometry(i);
18746  }
18747  /**
18748   * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry.
18749   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18750   */
18751  drawMultiLineString(t, i) {
18752    const s = this.state, n = s.strokeStyle, r = s.lineWidth;
18753    if (n === void 0 || r === void 0)
18754      return;
18755    this.updateStrokeStyle(s, this.applyStroke), this.beginGeometry(t, i), this.hitDetectionInstructions.push(
18756      [
18757        Q.SET_STROKE_STYLE,
18758        s.strokeStyle,
18759        s.lineWidth,
18760        s.lineCap,
18761        s.lineJoin,
18762        s.miterLimit,
18763        s.lineDash,
18764        s.lineDashOffset
18765      ],
18766      fs
18767    );
18768    const o = t.getEnds(), a = t.getFlatCoordinates(), l = t.getStride();
18769    let h = 0;
18770    for (let c = 0, u = o.length; c < u; ++c)
18771      h = this.drawFlatCoordinates_(
18772        a,
18773        h,
18774        /** @type {number} */
18775        o[c],
18776        l
18777      );
18778    this.hitDetectionInstructions.push(Bi), this.endGeometry(i);
18779  }
18780  /**
18781   * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
18782   */
18783  finish() {
18784    const t = this.state;
18785    return t.lastStroke != null && t.lastStroke != this.coordinates.length && this.instructions.push(Bi), this.reverseHitDetectionInstructions(), this.state = null, super.finish();
18786  }
18787  /**
18788   * @param {import("../canvas.js").FillStrokeState} state State.
18789   */
18790  applyStroke(t) {
18791    t.lastStroke != null && t.lastStroke != this.coordinates.length && (this.instructions.push(Bi), t.lastStroke = this.coordinates.length), t.lastStroke = 0, super.applyStroke(t), this.instructions.push(fs);
18792  }
18793}
18794const qC = KC;
18795class VC extends Dr {
18796  /**
18797   * @param {number} tolerance Tolerance.
18798   * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
18799   * @param {number} resolution Resolution.
18800   * @param {number} pixelRatio Pixel ratio.
18801   */
18802  constructor(t, i, s, n) {
18803    super(t, i, s, n);
18804  }
18805  /**
18806   * @param {Array<number>} flatCoordinates Flat coordinates.
18807   * @param {number} offset Offset.
18808   * @param {Array<number>} ends Ends.
18809   * @param {number} stride Stride.
18810   * @private
18811   * @return {number} End.
18812   */
18813  drawFlatCoordinatess_(t, i, s, n) {
18814    const r = this.state, o = r.fillStyle !== void 0, a = r.strokeStyle !== void 0, l = s.length;
18815    this.instructions.push(fs), this.hitDetectionInstructions.push(fs);
18816    for (let h = 0; h < l; ++h) {
18817      const c = s[h], u = this.coordinates.length, d = this.appendFlatLineCoordinates(
18818        t,
18819        i,
18820        c,
18821        n,
18822        !0,
18823        !a
18824      ), f = [
18825        Q.MOVE_TO_LINE_TO,
18826        u,
18827        d
18828      ];
18829      this.instructions.push(f), this.hitDetectionInstructions.push(f), a && (this.instructions.push(Wu), this.hitDetectionInstructions.push(Wu)), i = c;
18830    }
18831    return o && (this.instructions.push(eo), this.hitDetectionInstructions.push(eo)), a && (this.instructions.push(Bi), this.hitDetectionInstructions.push(Bi)), i;
18832  }
18833  /**
18834   * @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry.
18835   * @param {import("../../Feature.js").default} feature Feature.
18836   */
18837  drawCircle(t, i) {
18838    const s = this.state, n = s.fillStyle, r = s.strokeStyle;
18839    if (n === void 0 && r === void 0)
18840      return;
18841    this.setFillStrokeStyles_(), this.beginGeometry(t, i), s.fillStyle !== void 0 && this.hitDetectionInstructions.push([
18842      Q.SET_FILL_STYLE,
18843      xi
18844    ]), s.strokeStyle !== void 0 && this.hitDetectionInstructions.push([
18845      Q.SET_STROKE_STYLE,
18846      s.strokeStyle,
18847      s.lineWidth,
18848      s.lineCap,
18849      s.lineJoin,
18850      s.miterLimit,
18851      s.lineDash,
18852      s.lineDashOffset
18853    ]);
18854    const o = t.getFlatCoordinates(), a = t.getStride(), l = this.coordinates.length;
18855    this.appendFlatLineCoordinates(
18856      o,
18857      0,
18858      o.length,
18859      a,
18860      !1,
18861      !1
18862    );
18863    const h = [Q.CIRCLE, l];
18864    this.instructions.push(fs, h), this.hitDetectionInstructions.push(fs, h), s.fillStyle !== void 0 && (this.instructions.push(eo), this.hitDetectionInstructions.push(eo)), s.strokeStyle !== void 0 && (this.instructions.push(Bi), this.hitDetectionInstructions.push(Bi)), this.endGeometry(i);
18865  }
18866  /**
18867   * @param {impo
18867rt("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry.
18868   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18869   */
18870  drawPolygon(t, i) {
18871    const s = this.state, n = s.fillStyle, r = s.strokeStyle;
18872    if (n === void 0 && r === void 0)
18873      return;
18874    this.setFillStrokeStyles_(), this.beginGeometry(t, i), s.fillStyle !== void 0 && this.hitDetectionInstructions.push([
18875      Q.SET_FILL_STYLE,
18876      xi
18877    ]), s.strokeStyle !== void 0 && this.hitDetectionInstructions.push([
18878      Q.SET_STROKE_STYLE,
18879      s.strokeStyle,
18880      s.lineWidth,
18881      s.lineCap,
18882      s.lineJoin,
18883      s.miterLimit,
18884      s.lineDash,
18885      s.lineDashOffset
18886    ]);
18887    const o = t.getEnds(), a = t.getOrientedFlatCoordinates(), l = t.getStride();
18888    this.drawFlatCoordinatess_(
18889      a,
18890      0,
18891      /** @type {Array<number>} */
18892      o,
18893      l
18894    ), this.endGeometry(i);
18895  }
18896  /**
18897   * @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
18898   * @param {import("../../Feature.js").FeatureLike} feature Feature.
18899   */
18900  drawMultiPolygon(t, i) {
18901    const s = this.state, n = s.fillStyle, r = s.strokeStyle;
18902    if (n === void 0 && r === void 0)
18903      return;
18904    this.setFillStrokeStyles_(), this.beginGeometry(t, i), s.fillStyle !== void 0 && this.hitDetectionInstructions.push([
18905      Q.SET_FILL_STYLE,
18906      xi
18907    ]), s.strokeStyle !== void 0 && this.hitDetectionInstructions.push([
18908      Q.SET_STROKE_STYLE,
18909      s.strokeStyle,
18910      s.lineWidth,
18911      s.lineCap,
18912      s.lineJoin,
18913      s.miterLimit,
18914      s.lineDash,
18915      s.lineDashOffset
18916    ]);
18917    const o = t.getEndss(), a = t.getOrientedFlatCoordinates(), l = t.getStride();
18918    let h = 0;
18919    for (let c = 0, u = o.length; c < u; ++c)
18920      h = this.drawFlatCoordinatess_(
18921        a,
18922        h,
18923        o[c],
18924        l
18925      );
18926    this.endGeometry(i);
18927  }
18928  /**
18929   * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
18930   */
18931  finish() {
18932    this.reverseHitDetectionInstructions(), this.state = null;
18933    const t = this.tolerance;
18934    if (t !== 0) {
18935      const i = this.coordinates;
18936      for (let s = 0, n = i.length; s < n; ++s)
18937        i[s] = ls(i[s], t);
18938    }
18939    return super.finish();
18940  }
18941  /**
18942   * @private
18943   */
18944  setFillStrokeStyles_() {
18945    const t = this.state;
18946    t.fillStyle !== void 0 && this.updateFillStyle(t, this.createFill), t.strokeStyle !== void 0 && this.updateStrokeStyle(t, this.applyStroke);
18947  }
18948}
18949const Bu = VC;
18950function HC(e, t, i, s, n) {
18951  const r = [];
18952  let o = i, a = 0, l = t.slice(i, 2);
18953  for (; a < e && o + n < s; ) {
18954    const [h, c] = l.slice(-2), u = t[o + n], d = t[o + n + 1], f = Math.sqrt(
18955      (u - h) * (u - h) + (d - c) * (d - c)
18956    );
18957    if (a += f, a >= e) {
18958      const g = (e - a + f) / f, _ = Se(h, u, g), m = Se(c, d, g);
18959      l.push(_, m), r.push(l), l = [_, m], a == e && (o += n), a = 0;
18960    } else if (a < e)
18961      l.push(
18962        t[o + n],
18963        t[o + n + 1]
18964      ), o += n;
18965    else {
18966      const g = f - a, _ = Se(h, u, g / f), m = Se(c, d, g / f);
18967      l.push(_, m), r.push(l), l = [_, m], a = 0, o += n;
18968    }
18969  }
18970  return a > 0 && r.push(l), r;
18971}
18972function ZC(e, t, i, s, n) {
18973  let r = i, o = i, a = 0, l = 0, h = i, c, u, d, f, g, _, m, p, y, v;
18974  for (u = i; u < s; u += n) {
18975    const E = t[u], C = t[u + 1];
18976    g !== void 0 && (y = E - g, v = C - _, f = Math.sqrt(y * y + v * v), m !== void 0 && (l += d, c = Math.acos((m * y + p * v) / (d * f)), c > e && (l > a && (a = l, r = h, o = u), l = 0, h = u - n)), d = f, m = y, p = v), g = E, _ = C;
18977  }
18978  return l += f, l > a ? [h, u] : [r, o];
18979}
18980const Jn = {
18981  left: 0,
18982  end: 0,
18983  center: 0.5,
18984  right: 1,
18985  start: 1,
18986  top: 0,
18987  middle: 0.5,
18988  hanging: 0.2,
18989  alphabetic: 0.8,
18990  ideographic: 0.8,
18991  bottom: 1
18992};
18993class JC extends Dr {
18994  /**
18995   * @param {number} tolerance Tolerance.
18996   * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
18997   * @param {number} resolution Resolution.
18998   * @param {number} pixelRatio Pixel ratio.
18999   */
19000  constructor(t, i, s, n) {
19001    super(t, i, s, n), this.labels_ = null, this.text_ = "", this.textOffsetX_ = 0, this.textOffsetY_ = 0, this.textRotateWithView_ = void 0, this.textRotation_ = 0, this.textFillState_ = null, this.fillStates = {}, this.textStrokeState_ = null, this.strokeStates = {}, this.textState_ = /** @type {import("../canvas.js").TextState} */
19002    {}, this.textStates = {}, this.textKey_ = "", this.fillKey_ = "", this.strokeKey_ = "", this.declutterImageWithText_ = void 0;
19003  }
19004  /**
19005   * @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
19006   */
19007  finish() {
19008    const t = super.finish();
19009    return t.textStates = this.textStates, t.fillStates = this.fillStates, t.strokeStates = this.strokeStates, t;
19010  }
19011  /**
19012   * @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry.
19013   * @param {import("../../Feature.js").FeatureLike} feature Feature.
19014   */
19015  drawText(t, i) {
19016    const s = this.textFillState_, n = this.textStrokeState_, r = this.textState_;
19017    if (this.text_ === "" || !r || !s && !n)
19018      return;
19019    const o = this.coordinates;
19020    let a = o.length;
19021    const l = t.getType();
19022    let h = null, c = t.getStride();
19023    if (r.placement === "line" && (l == "LineString" || l == "MultiLineString" || l == "Polygon" || l == "MultiPolygon")) {
19024      if (!ee(this.getBufferedMaxExtent(), t.getExtent()))
19025        return;
19026      let u;
19027      if (h = t.getFlatCoordinates(), l == "LineString")
19028        u = [h.length];
19029      else if (l == "MultiLineString")
19030        u = /** @type {import("../../geom/MultiLineString.js").default} */
19031        t.getEnds();
19032      else if (l == "Polygon")
19033        u = /** @type {import("../../geom/Polygon.js").default} */
19034        t.getEnds().slice(0, 1);
19035      else if (l == "MultiPolygon") {
19036        const _ = (
19037          /** @type {import("../../geom/MultiPolygon.js").default} */
19038          t.getEndss()
19039        );
19040        u = [];
19041        for (let m = 0, p = _.length; m < p; ++m)
19042          u.push(_[m][0]);
19043      }
19044      this.beginGeometry(t, i);
19045      const d = r.repeat, f = d ? void 0 : r.textAlign;
19046      let g = 0;
19047      for (let _ = 0, m = u.length; _ < m; ++_) {
19048        let p;
19049        d ? p = HC(
19050          d * this.resolution,
19051          h,
19052          g,
19053          u[_],
19054          c
19055        ) : p = [h.slice(g, u[_])];
19056        for (let y = 0, v = p.length; y < v; ++y) {
19057          const E = p[y];
19058          let C = 0, w = E.length;
19059          if (f == null) {
19060            const R = ZC(
19061              r.maxAngle,
19062              E,
19063              0,
19064              E.length,
19065              2
19066            );
19067            C = R[0], w = R[1];
19068          }
19069          for (let R = C; R < w; R += c)
19070            o.push(E[R], E[R + 1]);
19071          const O = o.length;
19072          g = u[_], this.drawChars_(a, O), a = O;
19073        }
19074      }
19075      this.endGeometry(i);
19076    } else {
19077      let u = r.overflow ? null : [];
19078      switch (l) {
19079        case "Point":
19080        case "MultiPoint":
19081          h = /** @type {import("../../geom/MultiPoint.js").default} */
19082          t.getFlatCoordinates();
19083          break;
19084        case "LineString":
19085          h = /** @type {import("../../geom/LineString.js").default} */
19086          t.getFlatMidpoint();
19087          break;
19088        case "Circle":
19089          h = /** @type {import("../../geom/Circle.js").default} */
19090          t.getCenter();
19091          break;
19092        case "MultiLineString":
19093          h = /** @type {import("../../geom/MultiLineString.js").default} */
19094          t.getFlatMidpoints(), c = 2;
19095          break;
19096        case "Polygon":
19097          h = /** @type {import("../../geom/Polygon.js").default} */
19098          t.getFlatInteriorPoint(), r.overflow || u.push(h[2] / this.resolution), c = 3;
19099          break;
19100        case "MultiPolygon":
19101          const m = (
19102            /** @type {import("../../geom/MultiPolygon.js").default} */
19103            t.getFlatInteriorPoints()
19104          );
19105          h = [];
19106          for (let p = 0, y = m.length; p < y; p += 3)
19107            r.overflow || u.push(m[p + 2] / this.resolution), h.push(m[p], m[p + 1]);
19108          if (h.length === 0)
19109            return;
19110          c = 2;
19111          break;
19112      }
19113      const d = this.appendFlatPointCoordinates(h, c);
19114      if (d === a)
19115        return;
19116      if (u && (d - a) / 2 !== h.length / c) {
19117        let m = a / 2;
19118        u = u.filter((p, y) => {
19119          const v = o[(m + y) * 2] === h[y * c] && o[(m + y) * 2 + 1] === h[y * c + 1];
19120          return v || --m, v;
19121        });
19122      }
19123      this.saveTextStates_(), (r.backgroundFill || r.backgroundStroke) && (this.setFillStrokeStyle(
19124        r.backgroundFill,
19125        r.backgroundStroke
19126      ), r.backgroundFill && (this.updateFillStyle(this.state, this.createFill), this.hitDetectionInstructions.push(this.createFill(this.state))), r.backgroundStroke && (this.updateStrokeStyle(this.state, this.applyStroke), this.hitDetectionInstructions.push(this.createStroke(this.state)))), this.beginGeometry(t, i);
19127      let f = r.padding;
19128      if (f != ds && (r.scale[0] < 0 || r.scale[1] < 0)) {
19129        let m = r.padding[0], p = r.padding[1], y = r.padding[2], v = r.padding[3];
19130        r.scale[0] < 0 && (p = -p, v = -v), r.scale[1] < 0 && (m = -m, y = -y), f = [m, p, y, v];
19131      }
19132      const g = this.pixelRatio;
19133      this.instructions.push([
19134        Q.DRAW_IMAGE,
19135        a,
19136        d,
19137        null,
19138        NaN,
19139        NaN,
19140        NaN,
19141        1,
19142        0,
19143        0,
19144        this.textRotateWithView_,
19145        this.textRotation_,
19146        [1, 1],
19147        NaN,
19148        void 0,
19149        this.declutterImageWithText_,
19150        f == ds ? ds : f.map(function(m) {
19151          return m * g;
19152        }),
19153        !!r.backgroundFill,
19154        !!r.backgroundStroke,
19155        this.text_,
19156        this.textKey_,
19157        this.strokeKey_,
19158        this.fillKey_,
19159        this.textOffsetX_,
19160        this.textOffsetY_,
19161        u
19162      ]);
19163      const _ = 1 / g;
19164      this.hitDetectionInstructions.push([
19165        Q.DRAW_IMAGE,
19166        a,
19167        d,
19168        null,
19169        NaN,
19170        NaN,
19171        NaN,
19172        1,
19173        0,
19174        0,
19175        this.textRotateWithView_,
19176        this.textRotation_,
19177        [_, _],
19178        NaN,
19179        void 0,
19180        this.declutterImageWithText_,
19181        f,
19182        !!r.backgroundFill,
19183        !!r.backgroundStroke,
19184        this.text_,
19185        this.textKey_,
19186        this.strokeKey_,
19187        this.fillKey_,
19188        this.textOffsetX_,
19189        this.textOffsetY_,
19190        u
19191      ]), this.endGeometry(i);
19192    }
19193  }
19194  /**
19195   * @private
19196   */
19197  saveTextStates_() {
19198    const t = this.textStrokeState_, i = this.textState_, s = this.textFillState_, n = this.strokeKey_;
19199    t && (n in this.strokeStates || (this.strokeStates[n] = {
19200      strokeStyle: t.strokeStyle,
19201      lineCap: t.lineCap,
19202      lineDashOffset: t.lineDashOffset,
19203      lineWidth: t.lineWidth,
19204      lineJoin: t.lineJoin,
19205      miterLimit: t.miterLimit,
19206      lineDash: t.lineDash
19207    }));
19208    const r = this.textKey_;
19209    r in this.textStates || (this.textStates[r] = {
19210      font: i.font,
19211      textAlign: i.textAlign || _r,
19212      justify: i.justify,
19213      textBaseline: i.textBaseline || No,
19214      scale: i.scale
19215    });
19216    const o = this.fillKey_;
19217    s && (o in this.fillStates || (this.fillStates[o] = {
19218      fillStyle: s.fillStyle
19219    }));
19220  }
19221  /**
19222   * @private
19223   * @param {number} begin Begin.
19224   * @param {number} end End.
19225   */
19226  drawChars_(t, i) {
19227    const s = this.textStrokeState_, n = this.textState_, r = this.strokeKey_, o = this.textKey_, a = this.fillKey_;
19228    this.saveTextStates_();
19229    const l = this.pixelRatio, h = Jn[n.textBaseline], c = this.textOffsetY_ * l, u = this.text_, d = s ? s.lineWidth * Math.abs(n.scale[0]) / 2 : 0;
19230    this.instructions.push([
19231      Q.DRAW_CHARS,
19232      t,
19233      i,
19234      h,
19235      n.overflow,
19236      a,
19237      n.maxAngle,
19238      l,
19239      c,
19240      r,
19241      d * l,
19242      u,
19243      o,
19244      1
19245    ]), this.hitDetectionInstructions.push([
19246      Q.DRAW_CHARS,
19247      t,
19248      i,
19249      h,
19250      n.overflow,
19251      a,
19252      n.maxAngle,
19253      1,
19254      c,
19255      r,
19256      d,
19257      u,
19258      o,
19259      1 / l
19260    ]);
19261  }
19262  /**
19263   * @param {import("../../style/Text.js").default} textStyle Text style.
19264   * @param {Object} [sharedData] Shared data.
19265   */
19266  setTextStyle(t, i) {
19267    let s, n, r;
19268    if (!t)
19269      this.text_ = "";
19270    else {
19271      const o = t.getFill();
19272      o ? (n = this.textFillState_, n || (n = /** @type {import("../canvas.js").FillState} */
19273      {}, this.textFillState_ = n), n.fillStyle = Ze(
19274        o.getColor() || xi
19275      )) : (n = null, this.textFillState_ = n);
19276      const a = t.getStroke();
19277      if (!a)
19278        r = null, this.textStrokeState_ = r;
19279      else {
19280        r = this.textStrokeState_, r || (r = /** @type {import("../canvas.js").StrokeState} */
19281        {}, this.textStrokeState_ = r);
19282        const g = a.getLineDash(), _ = a.getLineDashOffset(), m = a.getWidth(), p = a.getMiterLimit();
19283        r.lineCap = a.getLineCap() || Do, r.lineDash = g ? g.slice() : ur, r.lineDashOffset = _ === void 0 ? dr : _, r.lineJoin = a.getLineJoin() || wn, r.lineWidth = m === void 0 ? mr : m, r.miterLimit = p === void 0 ? fr : p, r.strokeStyle = Ze(
19284          a.getColor() || gr
19285        );
19286      }
19287      s = this.textState_;
19288      const l = t.getFont() || fg;
19289      mM(l);
19290      const h = t.getScaleArray();
19291      s.overflow = t.getOverflow(), s.font = l, s.maxAngle = t.getMaxAngle(), s.placement = t.getPlacement(), s.textAlign = t.getTextAlign(), s.repeat = t.getRepeat(), s.justify = t.getJustify(), s.textBaseline = t.getTextBaseline() || No, s.backgroundFill = t.getBackgroundFill(), s.backgroundStroke = t.getBackgroundStroke(), s.padding = t.getPadding() || ds, s.scale = h === void 0 ? [1, 1] : h;
19292      const c = t.getOffsetX(), u = t.getOffsetY(), d = t.getRotateWithView(), f = t.getRotation();
19293      this.text_ = t.getText() || "", this.textOffsetX_ = c === void 0 ? 0 : c, this.textOffsetY_ = u === void 0 ? 0 : u, this.textRotateWithView_ = d === void 0 ? !1 : d, this.textRotation_ = f === void 0 ? 0 : f, this.strokeKey_ = r ? (typeof r.strokeStyle == "string" ? r.strokeStyle : ot(r.strokeStyle)) + r.lineCap + r.lineDashOffset + "|" + r.lineWidth + r.lineJoin + r.miterLimit + "[" + r.lineDash.join() + "]" : "", this.textKey_ = s.font + s.scale + (s.textAlign || "?") + (s.repeat || "?") + (s.justify || "?") + (s.textBaseline || "?"), this.fillKey_ = n ? typeof n.fillStyle == "string" ? n.fillStyle : "|" + ot(n.fillStyle) : "";
19294    }
19295    this.declutterImageWithText_ = i;
19296  }
19297}
19298const QC = {
19299  Circle: Bu,
19300  Default: Dr,
19301  Image: YC,
19302  LineString: qC,
19303  Polygon: Bu,
19304  Text: JC
19305};
19306class tb {
19307  /**
19308   * @param {number} tolerance Tolerance.
19309   * @param {import("../../extent.js").Extent} maxExtent Max extent.
19310   * @param {number} resolution Resolution.
19311   * @param {number} pixelRatio Pixel ratio.
19312   */
19313  constructor(t, i, s, n) {
19314    this.tolerance_ = t, this.maxExtent_ = i, this.pixelRatio_ = n, this.resolution_ = s, this.buildersByZIndex_ = {};
19315  }
19316  /**
19317   * @return {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Builder.js").SerializableInstructions>>}
19317 The serializable instructions
19318   */
19319  finish() {
19320    const t = {};
19321    for (const i in this.buildersByZIndex_) {
19322      t[i] = t[i] || {};
19323      const s = this.buildersByZIndex_[i];
19324      for (const n in s) {
19325        const r = s[n].finish();
19326        t[i][n] = r;
19327      }
19328    }
19329    return t;
19330  }
19331  /**
19332   * @param {number|undefined} zIndex Z index.
19333   * @param {import("../canvas.js").BuilderType} builderType Replay type.
19334   * @return {import("../VectorContext.js").default} Replay.
19335   */
19336  getBuilder(t, i) {
19337    const s = t !== void 0 ? t.toString() : "0";
19338    let n = this.buildersByZIndex_[s];
19339    n === void 0 && (n = {}, this.buildersByZIndex_[s] = n);
19340    let r = n[i];
19341    if (r === void 0) {
19342      const o = QC[i];
19343      r = new o(
19344        this.tolerance_,
19345        this.maxExtent_,
19346        this.resolution_,
19347        this.pixelRatio_
19348      ), n[i] = r;
19349    }
19350    return r;
19351  }
19352}
19353const Uu = tb;
19354class eb extends Kf {
19355  /**
19356   * @param {LayerType} layer Layer.
19357   */
19358  constructor(t) {
19359    super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = t, this.declutterExecutorGroup = null;
19360  }
19361  /**
19362   * Asynchronous layer level hit detection.
19363   * @param {import("../pixel.js").Pixel} pixel Pixel.
19364   * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
19365   * an array of features.
19366   */
19367  getFeatures(t) {
19368    return Z();
19369  }
19370  /**
19371   * @param {import("../pixel.js").Pixel} pixel Pixel.
19372   * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
19373   */
19374  getData(t) {
19375    return null;
19376  }
19377  /**
19378   * Determine whether render should be called.
19379   * @abstract
19380   * @param {import("../Map.js").FrameState} frameState Frame state.
19381   * @return {boolean} Layer is ready to be rendered.
19382   */
19383  prepareFrame(t) {
19384    return Z();
19385  }
19386  /**
19387   * Render the layer.
19388   * @abstract
19389   * @param {import("../Map.js").FrameState} frameState Frame state.
19390   * @param {HTMLElement} target Target that may be used to render content to.
19391   * @return {HTMLElement} The rendered element.
19392   */
19393  renderFrame(t, i) {
19394    return Z();
19395  }
19396  /**
19397   * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
19398   * @param {number} zoom Zoom level.
19399   * @param {import("../Tile.js").default} tile Tile.
19400   * @return {boolean|void} If `false`, the tile will not be considered loaded.
19401   */
19402  loadedTileCallback(t, i, s) {
19403    t[i] || (t[i] = {}), t[i][s.tileCoord.toString()] = s;
19404  }
19405  /**
19406   * Create a function that adds loaded tiles to the tile lookup.
19407   * @param {import("../source/Tile.js").default} source Tile source.
19408   * @param {import("../proj/Projection.js").default} projection Projection of the tiles.
19409   * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
19410   * @return {function(number, import("../TileRange.js").default):boolean} A function that can be
19411   *     called with a zoom level and a tile range to add loaded tiles to the lookup.
19412   * @protected
19413   */
19414  createLoadedTileFinder(t, i, s) {
19415    return (
19416      /**
19417       * @param {number} zoom Zoom level.
19418       * @param {import("../TileRange.js").default} tileRange Tile range.
19419       * @return {boolean} The tile range is fully loaded.
19420       */
19421      (n, r) => {
19422        const o = this.loadedTileCallback.bind(this, s, n);
19423        return t.forEachLoadedTile(i, n, r, o);
19424      }
19425    );
19426  }
19427  /**
19428   * @abstract
19429   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
19430   * @param {import("../Map.js").FrameState} frameState Frame state.
19431   * @param {number} hitTolerance Hit tolerance in pixels.
19432   * @param {import("./vector.js").FeatureCallback<T>} callback Feature callback.
19433   * @param {Array<import("./Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
19434   * @return {T|undefined} Callback result.
19435   * @template T
19436   */
19437  forEachFeatureAtCoordinate(t, i, s, n, r) {
19438  }
19439  /**
19440   * @return {LayerType} Layer.
19441   */
19442  getLayer() {
19443    return this.layer_;
19444  }
19445  /**
19446   * Perform action necessary to get the layer rendered after new fonts have loaded
19447   * @abstract
19448   */
19449  handleFontsChanged() {
19450  }
19451  /**
19452   * Handle changes in image state.
19453   * @param {import("../events/Event.js").default} event Image change event.
19454   * @private
19455   */
19456  handleImageChange_(t) {
19457    /** @type {import("../Image.js").default} */
19458    t.target.getState() === rt.LOADED && this.renderIfReadyAndVisible();
19459  }
19460  /**
19461   * Load the image if not already loaded, and register the image change
19462   * listener if needed.
19463   * @param {import("../ImageBase.js").default} image Image.
19464   * @return {boolean} `true` if the image is already loaded, `false` otherwise.
19465   * @protected
19466   */
19467  loadImage(t) {
19468    let i = t.getState();
19469    return i != rt.LOADED && i != rt.ERROR && t.addEventListener(et.CHANGE, this.boundHandleImageChange_), i == rt.IDLE && (t.load(), i = t.getState()), i == rt.LOADED;
19470  }
19471  /**
19472   * @protected
19473   */
19474  renderIfReadyAndVisible() {
19475    const t = this.getLayer();
19476    t && t.getVisible() && t.getSourceState() === "ready" && t.changed();
19477  }
19478  /**
19479   * Clean up.
19480   */
19481  disposeInternal() {
19482    delete this.layer_, super.disposeInternal();
19483  }
19484}
19485const ib = eb, Xu = [];
19486let Ys = null;
19487function sb() {
19488  Ys = re(1, 1, void 0, {
19489    willReadFrequently: !0
19490  });
19491}
19492class nb extends ib {
19493  /**
19494   * @param {LayerType} layer Layer.
19495   */
19496  constructor(t) {
19497    super(t), this.container = null, this.renderedResolution, this.tempTransform = Qe(), this.pixelTransform = Qe(), this.inversePixelTransform = Qe(), this.context = null, this.containerReused = !1, this.pixelContext_ = null, this.frameState = null;
19498  }
19499  /**
19500   * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
19501   * @param {number} col The column index.
19502   * @param {number} row The row index.
19503   * @return {Uint8ClampedArray|null} The image data.
19504   */
19505  getImageData(t, i, s) {
19506    Ys || sb(), Ys.clearRect(0, 0, 1, 1);
19507    let n;
19508    try {
19509      Ys.drawImage(t, i, s, 1, 1, 0, 0, 1, 1), n = Ys.getImageData(0, 0, 1, 1).data;
19510    } catch {
19511      return Ys = null, null;
19512    }
19513    return n;
19514  }
19515  /**
19516   * @param {import('../../Map.js').FrameState} frameState Frame state.
19517   * @return {string} Background color.
19518   */
19519  getBackground(t) {
19520    let s = this.getLayer().getBackground();
19521    return typeof s == "function" && (s = s(t.viewState.resolution)), s || void 0;
19522  }
19523  /**
19524   * Get a rendering container from an existing target, if compatible.
19525   * @param {HTMLElement} target Potential render target.
19526   * @param {string} transform CSS Transform.
19527   * @param {string} [backgroundColor] Background color.
19528   */
19529  useContainer(t, i, s) {
19530    const n = this.getLayer().getClassName();
19531    let r, o;
19532    if (t && t.className === n && (!s || t && t.style.backgroundColor && wi(
19533      Lo(t.style.backgroundColor),
19534      Lo(s)
19535    ))) {
19536      const a = t.firstElementChild;
19537      a instanceof HTMLCanvasElement && (o = a.getContext("2d"));
19538    }
19539    if (o && o.canvas.style.transform === i ? (this.container = t, this.context = o, this.containerReused = !0) : this.containerReused && (this.container = null, this.context = null, this.containerReused = !1), !this.container) {
19540      r = document.createElement("div"), r.className = n;
19541      let a = r.style;
19542      a.position = "absolute", a.width = "100%", a.height = "100%", o = re();
19543      const l = o.canvas;
19544      r.appendChild(l), a = l.style, a.position = "absolute", a.left = "0", a.transformOrigin = "top left", this.container = r, this.context = o;
19545    }
19546    !this.containerReused && s && !this.container.style.backgroundColor && (this.container.style.backgroundColor = s);
19547  }
19548  /**
19549   * @param {CanvasRenderingContext2D} context Context.
19550   * @param {import("../../Map.js").FrameState} frameState Frame state.
19551   * @param {import("../../extent.js").Extent} extent Clip extent.
19552   * @protected
19553   */
19554  clipUnrotated(t, i, s) {
19555    const n = Rs(s), r = Zo(s), o = Ho(s), a = Vo(s);
19556    zt(i.coordinateToPixelTransform, n), zt(i.coordinateToPixelTransform, r), zt(i.coordinateToPixelTransform, o), zt(i.coordinateToPixelTransform, a);
19557    const l = this.inversePixelTransform;
19558    zt(l, n), zt(l, r), zt(l, o), zt(l, a), t.save(), t.beginPath(), t.moveTo(Math.round(n[0]), Math.round(n[1])), t.lineTo(Math.round(r[0]), Math.round(r[1])
19558), t.lineTo(Math.round(o[0]), Math.round(o[1])), t.lineTo(Math.round(a[0]), Math.round(a[1])), t.clip();
19559  }
19560  /**
19561   * @param {import("../../render/EventType.js").default} type Event type.
19562   * @param {CanvasRenderingContext2D} context Context.
19563   * @param {import("../../Map.js").FrameState} frameState Frame state.
19564   * @private
19565   */
19566  dispatchRenderEvent_(t, i, s) {
19567    const n = this.getLayer();
19568    if (n.hasListener(t)) {
19569      const r = new ug(
19570        t,
19571        this.inversePixelTransform,
19572        s,
19573        i
19574      );
19575      n.dispatchEvent(r);
19576    }
19577  }
19578  /**
19579   * @param {CanvasRenderingContext2D} context Context.
19580   * @param {import("../../Map.js").FrameState} frameState Frame state.
19581   * @protected
19582   */
19583  preRender(t, i) {
19584    this.frameState = i, this.dispatchRenderEvent_(Vi.PRERENDER, t, i);
19585  }
19586  /**
19587   * @param {CanvasRenderingContext2D} context Context.
19588   * @param {import("../../Map.js").FrameState} frameState Frame state.
19589   * @protected
19590   */
19591  postRender(t, i) {
19592    this.dispatchRenderEvent_(Vi.POSTRENDER, t, i);
19593  }
19594  /**
19595   * Creates a transform for rendering to an element that will be rotated after rendering.
19596   * @param {import("../../coordinate.js").Coordinate} center Center.
19597   * @param {number} resolution Resolution.
19598   * @param {number} rotation Rotation.
19599   * @param {number} pixelRatio Pixel ratio.
19600   * @param {number} width Width of the rendered element (in pixels).
19601   * @param {number} height Height of the rendered element (in pixels).
19602   * @param {number} offsetX Offset on the x-axis in view coordinates.
19603   * @protected
19604   * @return {!import("../../transform.js").Transform} Transform.
19605   */
19606  getRenderTransform(t, i, s, n, r, o, a) {
19607    const l = r / 2, h = o / 2, c = n / i, u = -c, d = -t[0] + a, f = -t[1];
19608    return si(
19609      this.tempTransform,
19610      l,
19611      h,
19612      c,
19613      u,
19614      -s,
19615      d,
19616      f
19617    );
19618  }
19619  /**
19620   * Clean up.
19621   */
19622  disposeInternal() {
19623    delete this.frameState, super.disposeInternal();
19624  }
19625}
19626const ec = nb;
19627function rb(e, t, i, s, n, r, o, a, l, h, c, u) {
19628  let d = e[t], f = e[t + 1], g = 0, _ = 0, m = 0, p = 0;
19629  function y() {
19630    g = d, _ = f, t += s, d = e[t], f = e[t + 1], p += m, m = Math.sqrt((d - g) * (d - g) + (f - _) * (f - _));
19631  }
19632  do
19633    y();
19634  while (t < i - s && p + m < r);
19635  let v = m === 0 ? 0 : (r - p) / m;
19636  const E = Se(g, d, v), C = Se(_, f, v), w = t - s, O = p, R = r + a * l(h, n, c);
19637  for (; t < i - s && p + m < R; )
19638    y();
19639  v = m === 0 ? 0 : (R - p) / m;
19640  const j = Se(g, d, v), $ = Se(_, f, v);
19641  let V;
19642  if (u) {
19643    const Y = [E, C, j, $];
19644    Ph(Y, 0, 4, 2, u, Y, Y), V = Y[0] > Y[2];
19645  } else
19646    V = E > j;
19647  const tt = Math.PI, J = [], St = w + s === t;
19648  t = w, m = 0, p = O, d = e[t], f = e[t + 1];
19649  let K;
19650  if (St) {
19651    y(), K = Math.atan2(f - _, d - g), V && (K += K > 0 ? -tt : tt);
19652    const Y = (j + E) / 2, L = ($ + C) / 2;
19653    return J[0] = [Y, L, (R - r) / 2, K, n], J;
19654  }
19655  n = n.replace(/\n/g, " ");
19656  for (let Y = 0, L = n.length; Y < L; ) {
19657    y();
19658    let W = Math.atan2(f - _, d - g);
19659    if (V && (W += W > 0 ? -tt : tt), K !== void 0) {
19660      let pt = W - K;
19661      if (pt += pt > tt ? -2 * tt : pt < -tt ? 2 * tt : 0, Math.abs(pt) > o)
19662        return null;
19663    }
19664    K = W;
19665    const ut = Y;
19666    let ft = 0;
19667    for (; Y < L; ++Y) {
19668      const pt = V ? L - Y - 1 : Y, vt = a * l(h, n[pt], c);
19669      if (t + s < i && p + m < r + ft + vt / 2)
19670        break;
19671      ft += vt;
19672    }
19673    if (Y === ut)
19674      continue;
19675    const Tt = V ? n.substring(L - ut, L - Y) : n.substring(ut, Y);
19676    v = m === 0 ? 0 : (r + ft / 2 - p) / m;
19677    const I = Se(g, d, v), Vt = Se(_, f, v);
19678    J.push([I, Vt, ft / 2, W, Tt]), r += ft;
19679  }
19680  return J;
19681}
19682const zs = ve(), Ri = [], ai = [], li = [], Ii = [];
19683function $u(e) {
19684  return e[3].declutterBox;
19685}
19686const ob = new RegExp(
19687  /* eslint-disable prettier/prettier */
19688  "[" + String.fromCharCode(1425) + "-" + String.fromCharCode(2303) + String.fromCharCode(64285) + "-" + String.fromCharCode(65023) + String.fromCharCode(65136) + "-" + String.fromCharCode(65276) + String.fromCharCode(67584) + "-" + String.fromCharCode(69631) + String.fromCharCode(124928) + "-" + String.fromCharCode(126975) + "]"
19689  /* eslint-enable prettier/prettier */
19690);
19691function Yu(e, t) {
19692  return (t === "start" || t === "end") && !ob.test(e) && (t = t === "start" ? "left" : "right"), Jn[t];
19693}
19694function ab(e, t, i) {
19695  return i > 0 && e.push(`
19696`, ""), e.push(t, ""), e;
19697}
19698class lb {
19699  /**
19700   * @param {number} resolution Resolution.
19701   * @param {number} pixelRatio Pixel ratio.
19702   * @param {boolean} overlaps The replay can have overlapping geometries.
19703   * @param {import("../canvas.js").SerializableInstructions}
19703 instructions The serializable instructions
19704   */
19705  constructor(t, i, s, n) {
19706    this.overlaps = s, this.pixelRatio = i, this.resolution = t, this.alignFill_, this.instructions = n.instructions, this.coordinates = n.coordinates, this.coordinateCache_ = {}, this.renderedTransform_ = Qe(), this.hitDetectionInstructions = n.hitDetectionInstructions, this.pixelCoordinates_ = null, this.viewRotation_ = 0, this.fillStates = n.fillStates || {}, this.strokeStates = n.strokeStates || {}, this.textStates = n.textStates || {}, this.widths_ = {}, this.labels_ = {};
19707  }
19708  /**
19709   * @param {string|Array<string>} text Text.
19710   * @param {string} textKey Text style key.
19711   * @param {string} fillKey Fill style key.
19712   * @param {string} strokeKey Stroke style key.
19713   * @return {import("../canvas.js").Label} Label.
19714   */
19715  createLabel(t, i, s, n) {
19716    const r = t + i + s + n;
19717    if (this.labels_[r])
19718      return this.labels_[r];
19719    const o = n ? this.strokeStates[n] : null, a = s ? this.fillStates[s] : null, l = this.textStates[i], h = this.pixelRatio, c = [
19720      l.scale[0] * h,
19721      l.scale[1] * h
19722    ], u = Array.isArray(t), d = l.justify ? Jn[l.justify] : Yu(
19723      Array.isArray(t) ? t[0] : t,
19724      l.textAlign || _r
19725    ), f = n && o.lineWidth ? o.lineWidth : 0, g = u ? t : t.split(`
19726`).reduce(ab, []), { width: _, height: m, widths: p, heights: y, lineWidths: v } = yM(
19727      l,
19728      g
19729    ), E = _ + f, C = [], w = (E + 2) * c[0], O = (m + f) * c[1], R = {
19730      width: w < 0 ? Math.floor(w) : Math.ceil(w),
19731      height: O < 0 ? Math.floor(O) : Math.ceil(O),
19732      contextInstructions: C
19733    };
19734    (c[0] != 1 || c[1] != 1) && C.push("scale", c), n && (C.push("strokeStyle", o.strokeStyle), C.push("lineWidth", f), C.push("lineCap", o.lineCap), C.push("lineJoin", o.lineJoin), C.push("miterLimit", o.miterLimit), C.push("setLineDash", [o.lineDash]), C.push("lineDashOffset", o.lineDashOffset)), s && C.push("fillStyle", a.fillStyle), C.push("textBaseline", "middle"), C.push("textAlign", "center");
19735    const j = 0.5 - d;
19736    let $ = d * E + j * f;
19737    const V = [], tt = [];
19738    let J = 0, St = 0, K = 0, Y = 0, L;
19739    for (let W = 0, ut = g.length; W < ut; W += 2) {
19740      const ft = g[W];
19741      if (ft === `
19742`) {
19743        St += J, J = 0, $ = d * E + j * f, ++Y;
19744        continue;
19745      }
19746      const Tt = g[W + 1] || l.font;
19747      Tt !== L && (n && V.push("font", Tt), s && tt.push("font", Tt), L = Tt), J = Math.max(J, y[K]);
19748      const I = [
19749        ft,
19750        $ + j * p[K] + d * (p[K] - v[Y]),
19751        0.5 * (f + J) + St
19752      ];
19753      $ += p[K], n && V.push("strokeText", I), s && tt.push("fillText", I), ++K;
19754    }
19755    return Array.prototype.push.apply(C, V), Array.prototype.push.apply(C, tt), this.labels_[r] = R, R;
19756  }
19757  /**
19758   * @param {CanvasRenderingContext2D} context Context.
19759   * @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
19760   * @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
19761   * @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
19762   * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
19763   * @param {Array<*>} fillInstruction Fill instruction.
19764   * @param {Array<*>} strokeInstruction Stroke instruction.
19765   */
19766  replayTextBackground_(t, i, s, n, r, o, a) {
19767    t.beginPath(), t.moveTo.apply(t, i), t.lineTo.apply(t, s), t.lineTo.apply(t, n), t.lineTo.apply(t, r), t.lineTo.apply(t, i), o && (this.alignFill_ = /** @type {boolean} */
19768    o[2], this.fill_(t)), a && (this.setStrokeStyle_(
19769      t,
19770      /** @type {Array<*>} */
19771      a
19772    ), t.stroke());
19773  }
19774  /**
19775   * @private
19776   * @param {number} sheetWidth Width of the sprite sheet.
19777   * @param {number} sheetHeight Height of the sprite sheet.
19778   * @param {number} centerX X.
19779   * @param {number} centerY Y.
19780   * @param {number} width Width.
19781   * @param {number} height Height.
19782   * @param {number} anchorX Anchor X.
19783   * @param {number} anchorY Anchor Y.
19784   * @param {number} originX Origin X.
19785   * @param {number} originY Origin Y.
19786   * @param {number} rotation Rotation.
19787   * @param {import("../../size.js").Size} scale Scale.
19788   * @param {boolean} snapToPixel Snap to pixel.
19789   * @param {Array<number>} padding Padding.
19790   * @param {boolean}
19790 fillStroke Background fill or stroke.
19791   * @param {import("../../Feature.js").FeatureLike} feature Feature.
19792   * @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.
19793   */
19794  calculateImageOrLabelDimensions_(t, i, s, n, r, o, a, l, h, c, u, d, f, g, _, m) {
19795    a *= d[0], l *= d[1];
19796    let p = s - a, y = n - l;
19797    const v = r + h > t ? t - h : r, E = o + c > i ? i - c : o, C = g[3] + v * d[0] + g[1], w = g[0] + E * d[1] + g[2], O = p - g[3], R = y - g[0];
19798    (_ || u !== 0) && (Ri[0] = O, Ii[0] = O, Ri[1] = R, ai[1] = R, ai[0] = O + C, li[0] = ai[0], li[1] = R + w, Ii[1] = li[1]);
19799    let j;
19800    return u !== 0 ? (j = si(
19801      Qe(),
19802      s,
19803      n,
19804      1,
19805      1,
19806      u,
19807      -s,
19808      -n
19809    ), zt(j, Ri), zt(j, ai), zt(j, li), zt(j, Ii), ei(
19810      Math.min(Ri[0], ai[0], li[0], Ii[0]),
19811      Math.min(Ri[1], ai[1], li[1], Ii[1]),
19812      Math.max(Ri[0], ai[0], li[0], Ii[0]),
19813      Math.max(Ri[1], ai[1], li[1], Ii[1]),
19814      zs
19815    )) : ei(
19816      Math.min(O, O + C),
19817      Math.min(R, R + w),
19818      Math.max(O, O + C),
19819      Math.max(R, R + w),
19820      zs
19821    ), f && (p = Math.round(p), y = Math.round(y)), {
19822      drawImageX: p,
19823      drawImageY: y,
19824      drawImageW: v,
19825      drawImageH: E,
19826      originX: h,
19827      originY: c,
19828      declutterBox: {
19829        minX: zs[0],
19830        minY: zs[1],
19831        maxX: zs[2],
19832        maxY: zs[3],
19833        value: m
19834      },
19835      canvasTransform: j,
19836      scale: d
19837    };
19838  }
19839  /**
19840   * @private
19841   * @param {CanvasRenderingContext2D} context Context.
19842   * @param {number} contextScale Scale of the context.
19843   * @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
19844   * @param {ImageOrLabelDimensions} dimensions Dimensions.
19845   * @param {number} opacity Opacity.
19846   * @param {Array<*>} fillInstruction Fill instruction.
19847   * @param {Array<*>} strokeInstruction Stroke instruction.
19848   * @return {boolean} The image or label was rendered.
19849   */
19850  replayImageOrLabel_(t, i, s, n, r, o, a) {
19851    const l = !!(o || a), h = n.declutterBox, c = t.canvas, u = a ? a[2] * n.scale[0] / 2 : 0;
19852    return h.minX - u <= c.width / i && h.maxX + u >= 0 && h.minY - u <= c.height / i && h.maxY + u >= 0 && (l && this.replayTextBackground_(
19853      t,
19854      Ri,
19855      ai,
19856      li,
19857      Ii,
19858      /** @type {Array<*>} */
19859      o,
19860      /** @type {Array<*>} */
19861      a
19862    ), xM(
19863      t,
19864      n.canvasTransform,
19865      r,
19866      s,
19867      n.originX,
19868      n.originY,
19869      n.drawImageW,
19870      n.drawImageH,
19871      n.drawImageX,
19872      n.drawImageY,
19873      n.scale
19874    )), !0;
19875  }
19876  /**
19877   * @private
19878   * @param {CanvasRenderingContext2D} context Context.
19879   */
19880  fill_(t) {
19881    if (this.alignFill_) {
19882      const i = zt(this.renderedTransform_, [0, 0]), s = 512 * this.pixelRatio;
19883      t.save(), t.translate(i[0] % s, i[1] % s), t.rotate(this.viewRotation_);
19884    }
19885    t.fill(), this.alignFill_ && t.restore();
19886  }
19887  /**
19888   * @private
19889   * @param {CanvasRenderingContext2D} context Context.
19890   * @param {Array<*>} instruction Instruction.
19891   */
19892  setStrokeStyle_(t, i) {
19893    t.strokeStyle = /** @type {import("../../colorlike.js").ColorLike} */
19894    i[1], t.lineWidth = /** @type {number} */
19895    i[2], t.lineCap = /** @type {CanvasLineCap} */
19896    i[3], t.lineJoin = /** @type {CanvasLineJoin} */
19897    i[4], t.miterLimit = /** @type {number} */
19898    i[5], t.lineDashOffset = /** @type {number} */
19899    i[7], t.setLineDash(
19900      /** @type {Array<number>} */
19901      i[6]
19902    );
19903  }
19904  /**
19905   * @private
19906   * @param {string|Array<string>} text The text to draw.
19907   * @param {string} textKey The key of the text state.
19908   * @param {string} strokeKey The key for the stroke state.
19909   * @param {string} fillKey The key for the fill state.
19910   * @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor.
19911   */
19912  drawLabelWithPointPlacement_(t, i, s, n) {
19913    const r = this.textStates[i], o = this.createLabel(t, i, n, s), a = this.strokeStates[s], l = this.pixelRatio, h = Yu(
19914      Array.isArray(t) ? t[0] : t,
19915      r.textAlign || _r
19916    ), c = Jn[r.textBaseline || No], u = a && a.lineWidth ? a.lineWidth : 0, d = o.width / l - 2 * r.scale[0], f = h * d + 2 * (0.5 - h) * u, g = c * o.height / l + 2 * (0.5 - c) * u;
19917    return {
19918      label: o,
19919      anchorX: f,
19920      anchorY: g
19921    };
19922  }
19923  /**
19924   * @private
19925   * @param {CanvasRenderingContext2D} context Context.
19926   * @param {number} contextScale Scale of the context.
19927   * @param {import("../../transform.js").Transform} transform Transform.
19928   * @param {Array<*>}
19928 instructions Instructions array.
19929   * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
19930   * @param {FeatureCallback<T>} [featureCallback] Feature callback.
19931   * @param {import("../../extent.js").Extent} [hitExtent] Only check
19932   *     features that intersect this extent.
19933   * @param {import("rbush").default} [declutterTree] Declutter tree.
19934   * @return {T|undefined} Callback result.
19935   * @template T
19936   */
19937  execute_(t, i, s, n, r, o, a, l) {
19938    let h;
19939    this.pixelCoordinates_ && wi(s, this.renderedTransform_) ? h = this.pixelCoordinates_ : (this.pixelCoordinates_ || (this.pixelCoordinates_ = []), h = ps(
19940      this.coordinates,
19941      0,
19942      this.coordinates.length,
19943      2,
19944      s,
19945      this.pixelCoordinates_
19946    ), yE(this.renderedTransform_, s));
19947    let c = 0;
19948    const u = n.length;
19949    let d = 0, f, g, _, m, p, y, v, E, C, w, O, R, j = 0, $ = 0, V = null, tt = null;
19950    const J = this.coordinateCache_, St = this.viewRotation_, K = Math.round(Math.atan2(-s[1], s[0]) * 1e12) / 1e12, Y = (
19951      /** @type {import("../../render.js").State} */
19952      {
19953        context: t,
19954        pixelRatio: this.pixelRatio,
19955        resolution: this.resolution,
19956        rotation: St
19957      }
19958    ), L = this.instructions != n || this.overlaps ? 0 : 200;
19959    let W, ut, ft, Tt;
19960    for (; c < u; ) {
19961      const I = n[c];
19962      switch (
19963        /** @type {import("./Instruction.js").default} */
19964        I[0]
19965      ) {
19966        case Q.BEGIN_GEOMETRY:
19967          W = /** @type {import("../../Feature.js").FeatureLike} */
19968          I[1], Tt = I[3], W.getGeometry() ? a !== void 0 && !ee(a, Tt.getExtent()) ? c = /** @type {number} */
19969          I[2] + 1 : ++c : c = /** @type {number} */
19970          I[2];
19971          break;
19972        case Q.BEGIN_PATH:
19973          j > L && (this.fill_(t), j = 0), $ > L && (t.stroke(), $ = 0), !j && !$ && (t.beginPath(), m = NaN, p = NaN), ++c;
19974          break;
19975        case Q.CIRCLE:
19976          d = /** @type {number} */
19977          I[1];
19978          const pt = h[d], vt = h[d + 1], Bt = h[d + 2], oe = h[d + 3], Gt = Bt - pt, Ht = oe - vt, Ue = Math.sqrt(Gt * Gt + Ht * Ht);
19979          t.moveTo(pt + Ue, vt), t.arc(pt, vt, Ue, 0, 2 * Math.PI, !0), ++c;
19980          break;
19981        case Q.CLOSE_PATH:
19982          t.closePath(), ++c;
19983          break;
19984        case Q.CUSTOM:
19985          d = /** @type {number} */
19986          I[1], f = I[2];
19987          const Si = (
19988            /** @type {import("../../geom/SimpleGeometry.js").default} */
19989            I[3]
19990          ), x = I[4], M = I.length == 6 ? I[5] : void 0;
19991          Y.geometry = Si, Y.feature = W, c in J || (J[c] = []);
19992          const b = J[c];
19993          M ? M(h, d, f, 2, b) : (b[0] = h[d], b[1] = h[d + 1], b.length = 2), x(b, Y), ++c;
19994          break;
19995        case Q.DRAW_IMAGE:
19996          d = /** @type {number} */
19997          I[1], f = /** @type {number} */
19998          I[2], E = /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */
19999          I[3], g = /** @type {number} */
20000          I[4], _ = /** @type {number} */
20001          I[5];
20002          let T = (
20003            /** @type {number} */
20004            I[6]
20005          );
20006          const S = (
20007            /** @type {number} */
20008            I[7]
20009          ), k = (
20010            /** @type {number} */
20011            I[8]
20012          ), N = (
20013            /** @type {number} */
20014            I[9]
20015          ), F = (
20016            /** @type {boolean} */
20017            I[10]
20018          );
20019          let D = (
20020            /** @type {number} */
20021            I[11]
20022          );
20023          const P = (
20024            /** @type {import("../../size.js").Size} */
20025            I[12]
20026          );
20027          let B = (
20028            /** @type {number} */
20029            I[13]
20030          );
20031          const z = (
20032            /** @type {"declutter"|"obstacle"|"none"|undefined} */
20033            I[14]
20034          ), X = (
20035            /** @type {import("../canvas.js").DeclutterImageWithText} */
20036            I[15]
20037          );
20038          if (!E && I.length >= 20) {
20039            C = /** @type {string} */
20040            I[19], w = /** @type {string} */
20041            I[20], O = /** @type {string} */
20042            I[21], R = /** @type {string} */
20043            I[22];
20044            const be = this.drawLabelWithPointPlacement_(
20045              C,
20046              w,
20047              O,
20048              R
20049            );
20050            E = be.label, I[3] = E;
20051            const ks = (
20052              /** @type {number} */
20053              I[23]
20054            );
20055            g = (be.anchorX - ks) * this.pixelRatio, I[4] = g;
20056            const Te = (
20057              /** @type {number} */
20058              I[24]
20059            );
20060            _ = (be.anchorY - Te) * this.pixelRatio, I[5] = _, T = E.height, I[6] = T, B = E.width, I[13] = B;
20061          }
20062          let q;
20063          I.length > 25 && (q = /** @type {number} */
20064          I[25]);
20065          let nt, gt, ct;
20066          I.length > 17 ? (nt = /** @type {Array<number>} */
20067          I[16], gt = /** @type {boolean} */
20068          I[17], ct = /** @type {boolean} */
20069          I[18]) : (nt = ds, gt = !1, ct = !1), F && K ? D += St : !F && !K && (D -= St);
20070          let bt = 0;
20071          for (; d < f; d += 2) {
20072            if (q && q[bt++] < B / this.pixelRatio)
20073              continue;
20074            const be = this.calculateImageOrLabelDimensions_(
20075              E.width,
20076              E.height,
20077              h[d],
20078              h[d + 1],
20079              B,
20080              T,
20081              g,
20082              _,
20083              k,
20084              N,
20085              D,
20086              P,
20087              r,
20088              nt,
20089              gt || ct,
20090              W
20091            ), ks = [
20092              t,
20093              i,
20094              E,
20095              be,
20096              S,
20097              gt ? (
20098                /** @type {Array<*>} */
20099                V
20100              ) : null,
20101              ct ? (
20102                /** @type {Array<*>} */
20103                tt
20104              ) : null
20105            ];
20106            if (l) {
20107              if (z === "none")
20108                continue;
20109              if (z === "obstacle") {
20110                l.insert(be.declutterBox);
20111                continue;
20112              } else {
20113                let Te, ri;
20114                if (X) {
20115                  const we = f - d;
20116                  if (!X[we]) {
20117                    X[we] = ks;
20118                    continue;
20119                  }
20120                  if (Te = X[we], delete X[we], ri = $u(Te), l.collides(ri))
20121                    continue;
20122                }
20123                if (l.collides(be.declutterBox))
20124                  continue;
20125                Te && (l.insert(ri), this.replayImageOrLabel_.apply(this, Te)), l.insert(be.declutterBox);
20126              }
20127            }
20128            this.replayImageOrLabel_.apply(this, ks);
20129          }
20130          ++c;
20131          break;
20132        case Q.DRAW_CHARS:
20133          const Zt = (
20134            /** @type {number} */
20135            I[1]
20136          ), kt = (
20137            /** @type {number} */
20138            I[2]
20139          ), Os = (
20140            /** @type {number} */
20141            I[3]
20142          ), ss = (
20143            /** @type {number} */
20144            I[4]
20145          );
20146          R = /** @type {string} */
20147          I[5];
20148          const Nr = (
20149            /** @type {number} */
20150            I[6]
20151          ), Jt = (
20152            /** @type {number} */
20153            I[7]
20154          ), Ce = (
20155            /** @type {number} */
20156            I[8]
20157          );
20158          O = /** @type {string} */
20159          I[9];
20160          const Fs = (
20161            /** @type {number} */
20162            I[10]
20163          );
20164          C = /** @type {string} */
20165          I[11], w = /** @type {string} */
20166          I[12];
20167          const cc = [
20168            /** @type {number} */
20169            I[13],
20170            /** @type {number} */
20171            I[13]
20172          ], Ca = this.textStates[w], An = Ca.font, Ln = [
20173            Ca.scale[0] * Jt,
20174            Ca.scale[1] * Jt
20175          ];
20176          let On;
20177          An in this.widths_ ? On = this.widths_[An] : (On = {}, this.widths_[An] = On);
20178          const uc = wg(h, Zt, kt, 2), dc = Math.abs(Ln[0]) * Ou(An, C, On);
20179          if (ss || dc <= uc) {
20180            const be = this.textStates[w].textAlign, ks = (uc - dc) * Jn[be], Te = rb(
20181              h,
20182              Zt,
20183              kt,
20184              2,
20185              C,
20186              ks,
20187              Nr,
20188              Math.abs(Ln[0]),
20189              Ou,
20190              An,
20191              On,
20192              K ? 0 : this.viewRotation_
20193            );
20194            t:
20195              if (Te) {
20196                const ri = [];
20197                let we, Gr, zr, fe, Re;
20198                if (O)
20199                  for (we = 0, Gr = Te.length; we < Gr; ++we) {
20200                    Re = Te[we], zr = /** @type {string} */
20201                    Re[4], fe = this.createLabel(zr, w, "", O), g = /** @type {number} */
20202                    Re[2] + (Ln[0] < 0 ? -Fs : Fs), _ = Os * fe.height + (0.5 - Os) * 2 * Fs * Ln[1] / Ln[0] - Ce;
20203                    const oi = this.calculateImageOrLabelDimensions_(
20204                      fe.width,
20205                      fe.height,
20206                      Re[0],
20207                      Re[1],
20208                      fe.width,
20209                      fe.height,
20210                      g,
20211                      _,
20212                      0,
20213                      0,
20214                      Re[3],
20215                      cc,
20216                      !1,
20217                      ds,
20218                      !1,
20219                      W
20220                    );
20221                    if (l && l.collides(oi.declutterBox))
20222                      break t;
20223                    ri.push([
20224                      t,
20225                      i,
20226                      fe,
20227                      oi,
20228                      1,
20229                      null,
20230                      null
20231                    ]);
20232                  }
20233                if (R)
20234                  for (we = 0, Gr = Te.length; we < Gr; ++we) {
20235                    Re = Te[we], zr = /** @type {string} */
20236                    Re[4], fe = this.createLabel(zr, w, R, ""), g = /** @type {number} */
20237                    Re[2], _ = Os * fe.height - Ce;
20238                    const oi = this.calculateImageOrLabelDimensions_(
20239                      fe.width,
20240                      fe.height,
20241                      Re[0],
20242                      Re[1],
20243                      fe.width,
20244                      fe.height,
20245                      g,
20246                      _,
20247                      0,
20248                      0,
20249                      Re[3],
20250                      cc,
20251                      !1,
20252                      ds,
20253                      !1,
20254                      W
20255                    );
20256                    if (l && l.collides(oi.declutterBox))
20257                      break t;
20258                    ri.push([
20259                      t,
20260                      i,
20261                      fe,
20262                      oi,
20263                      1,
20264                      null,
20265                      null
20266                    ]);
20267                  }
20268                l && l.load(ri.map($u));
20269                for (let oi = 0, a_ = ri.length; oi < a_; ++oi)
20270                  this.replayImageOrLabel_.apply(this, ri[oi]);
20271              }
20272          }
20273          ++c;
20274          break;
20275        case Q.END_GEOMETRY:
20276          if (o !== void 0) {
20277            W = /** @type {import("../../Feature.js").FeatureLike} */
20278            I[1];
20279            const be = o(W, Tt);
20280            if (be)
20281              return be;
20282          }
20283          ++c;
20284          break;
20285        case Q.FILL:
20286          L ? j++ : this.fill_(t), ++c;
20287          break;
20288        case Q.MOVE_TO_LINE_TO:
20289          for (d = /** @type {number} */
20290          I[1], f = /** @type {number} */
20291          I[2], ut = h[d], ft = h[d + 1], y = ut + 0.5 | 0, v = ft + 0.5 | 0, (y !== m || v !== p) && (t.moveTo(ut, ft), m = y, p = v), d += 2; d < f; d += 2)
20292            ut = h[d], ft = h[d + 1], y = ut + 0.5 | 0, v = ft + 0.5 | 0, (d == f - 2 || y !== m || v !== p) && (t.lineTo(ut, ft), m = y, p = v);
20293          ++c;
20294          break;
20295        case Q.SET_FILL_STYLE:
20296          V = I, this.alignFill_ = I[2], j && (this.fill_(t), j = 0, $ && (t.stroke(), $ = 0)), t.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */
20297          I[1], ++c;
20298          break;
20299        case Q.SET_STROKE_STYLE:
20300          tt = I, $ && (t.stroke(), $ = 0), this.setStrokeStyle_(
20301            t,
20302            /** @type {Array<*>} */
20303            I
20304          ), ++c;
20305          break;
20306        case Q.STROKE:
20307          L ? $++ : t.stroke(), ++c;
20308          break;
20309        default:
20310          ++c;
20311          break;
20312      }
20313    }
20314    j && this.fill_(t), $ && t.stroke();
20315  }
20316  /**
20317   * @param {CanvasRenderingContext2D} context Context.
20318   * @param {number} contextScale Scale of the context.
20319   * @param {import("../../transform.js").Transform} transform Transform.
20320   * @param {number} viewRotation View rotation.
20321   * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
20322   * @param {import("rbush").default} [declutterTree] Declutter tree.
20323   */
20324  execute(t, i, s, n, r, o) {
20325    this.viewRotation_ = n, this.execute_(
20326      t,
20327      i,
20328      s,
20329      this.instructions,
20330      r,
20331      void 0,
20332      void 0,
20333      o
20334    );
20335  }
20336  /**
20337   * @param {CanvasRenderingContext2D} context Context.
20338   * @param {import("../../transform.js").Transform} transform Transform.
20339   * @param {number} viewRotation View rotation.
20340   * @param {FeatureCallback<T>}
20340 [featureCallback] Feature callback.
20341   * @param {import("../../extent.js").Extent} [hitExtent] Only check
20342   *     features that intersect this extent.
20343   * @return {T|undefined} Callback result.
20344   * @template T
20345   */
20346  executeHitDetection(t, i, s, n, r) {
20347    return this.viewRotation_ = s, this.execute_(
20348      t,
20349      1,
20350      i,
20351      this.hitDetectionInstructions,
20352      !0,
20353      n,
20354      r
20355    );
20356  }
20357}
20358const hb = lb, Xa = ["Polygon", "Circle", "LineString", "Image", "Text", "Default"];
20359class cb {
20360  /**
20361   * @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
20362   * `maxExtent` was set on the Builder for this executor group, the same `maxExtent`
20363   * should be set here, unless the target context does not exceed that extent (which
20364   * can be the case when rendering to tiles).
20365   * @param {number} resolution Resolution.
20366   * @param {number} pixelRatio Pixel ratio.
20367   * @param {boolean} overlaps The executor group can have overlapping geometries.
20368   * @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions
20369   * The serializable instructions.
20370   * @param {number} [renderBuffer] Optional rendering buffer.
20371   */
20372  constructor(t, i, s, n, r, o) {
20373    this.maxExtent_ = t, this.overlaps_ = n, this.pixelRatio_ = s, this.resolution_ = i, this.renderBuffer_ = o, this.executorsByZIndex_ = {}, this.hitDetectionContext_ = null, this.hitDetectionTransform_ = Qe(), this.createExecutors_(r);
20374  }
20375  /**
20376   * @param {CanvasRenderingContext2D} context Context.
20377   * @param {import("../../transform.js").Transform} transform Transform.
20378   */
20379  clip(t, i) {
20380    const s = this.getClipCoords(i);
20381    t.beginPath(), t.moveTo(s[0], s[1]), t.lineTo(s[2], s[3]), t.lineTo(s[4], s[5]), t.lineTo(s[6], s[7]), t.clip();
20382  }
20383  /**
20384   * Create executors and populate them using the provided instructions.
20385   * @private
20386   * @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions The serializable instructions
20387   */
20388  createExecutors_(t) {
20389    for (const i in t) {
20390      let s = this.executorsByZIndex_[i];
20391      s === void 0 && (s = {}, this.executorsByZIndex_[i] = s);
20392      const n = t[i];
20393      for (const r in n) {
20394        const o = n[r];
20395        s[r] = new hb(
20396          this.resolution_,
20397          this.pixelRatio_,
20398          this.overlaps_,
20399          o
20400        );
20401      }
20402    }
20403  }
20404  /**
20405   * @param {Array<import("../canvas.js").BuilderType>} executors Executors.
20406   * @return {boolean} Has executors of the provided types.
20407   */
20408  hasExecutors(t) {
20409    for (const i in this.executorsByZIndex_) {
20410      const s = this.executorsByZIndex_[i];
20411      for (let n = 0, r = t.length; n < r; ++n)
20412        if (t[n] in s)
20413          return !0;
20414    }
20415    return !1;
20416  }
20417  /**
20418   * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
20419   * @param {number} resolution Resolution.
20420   * @param {number} rotation Rotation.
20421   * @param {number} hitTolerance Hit tolerance in pixels.
20422   * @param {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default, number): T} callback Feature callback.
20423   * @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
20424   * @return {T|undefined} Callback result.
20425   * @template T
20426   */
20427  forEachFeatureAtCoordinate(t, i, s, n, r, o) {
20428    n = Math.round(n);
20429    const a = n * 2 + 1, l = si(
20430      this.hitDetectionTransform_,
20431      n + 0.5,
20432      n + 0.5,
20433      1 / i,
20434      -1 / i,
20435      -s,
20436      -t[0],
20437      -t[1]
20438    ), h = !this.hitDetectionContext_;
20439    h && (this.hitDetectionContext_ = re(
20440      a,
20441      a,
20442      void 0,
20443      { willReadFrequently: !0 }
20444    ));
20445    const c = this.hitDetectionContext_;
20446    c.canvas.width !== a || c.canvas.height !== a ? (c.canvas.width = a, c.canvas.height = a) : h || c.clearRect(0, 0, a, a);
20447    let u;
20448    this.renderBuffer_ !== void 0 && (u = ve(), qn(u, t), Ms(
20449      u,
20450      i * (this.renderBuffer_ + n),
20451      u
20452    ));
20453    const d = ub(n);
20454    let f;
20455    function g(C, w) {
20456      const O = c.getImageData(
20457        0,
20458        0,
20459        a,
20460        a
20461      ).data;
20462      for (let R = 0, j = d.length; R < j; R++)
20463        if (O[d[R]] > 0) {
20464          if (!o || f !== "Image" && f !== "Text" || o.includes(C)) {
20465            const $ = (d[R] - 3) / 4, V = n - $ % a, tt = n - ($ / a | 0), J = r(C, w, V * V + tt * tt);
20466            if (J)
20467              return J;
20468          }
20469          c.clearRect(0, 0, a, a);
20470          break;
20471        }
20472    }
20473    const _ = Object.keys(this.executorsByZIndex_).map(Number);
20474    _.sort(ws);
20475    let m, p, y, v, E;
20476    for (m = _.length - 1; m >= 0; --m) {
20477      const C = _[m].toString();
20478      for (y = this.executorsByZIndex_[C], p = Xa.length - 1; p >= 0; --p)
20479        if (f = Xa[p], v = y[f], v !== void 0 && (E = v.executeHitDetection(
20480          c,
20481          l,
20482          s,
20483          g,
20484          u
20485        ), E))
20486          return E;
20487    }
20488  }
20489  /**
20490   * @param {import("../../transform.js").Transform} transform Transform.
20491   * @return {Array<number>|null} Clip coordinates.
20492   */
20493  getClipCoords(t) {
20494    const i = this.maxExtent_;
20495    if (!i)
20496      return null;
20497    const s = i[0], n = i[1], r = i[2], o = i[3], a = [s, n, s, o, r, o, r, n];
20498    return ps(a, 0, 8, 2, t, a), a;
20499  }
20500  /**
20501   * @return {boolean} Is empty.
20502   */
20503  isEmpty() {
20504    return _n(this.executorsByZIndex_);
20505  }
20506  /**
20507   * @param {CanvasRenderingContext2D} context Context.
20508   * @param {number} contextScale Scale of the context.
20509   * @param {import("../../transform.js").Transform} transform Transform.
20510   * @param {number} viewRotation View rotation.
20511   * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
20512   * @param {Array<import("../canvas.js").BuilderType>} [builderTypes] Ordered replay types to replay.
20513   *     Default is {@link module:ol/render/replay~ORDER}
20514   * @param {import("rbush").default} [declutterTree] Declutter tree.
20515   */
20516  execute(t, i, s, n, r, o, a) {
20517    const l = Object.keys(this.executorsByZIndex_).map(Number);
20518    l.sort(ws), this.maxExtent_ && (t.save(), this.clip(t, s)), o = o || Xa;
20519    let h, c, u, d, f, g;
20520    for (a && l.reverse(), h = 0, c = l.length; h < c; ++h) {
20521      const _ = l[h].toString();
20522      for (f = this.executorsByZIndex_[_], u = 0, d = o.length; u < d; ++u) {
20523        const m = o[u];
20524        g = f[m], g !== void 0 && g.execute(
20525          t,
20526          i,
20527          s,
20528          n,
20529          r,
20530          a
20531        );
20532      }
20533    }
20534    this.maxExtent_ && t.restore();
20535  }
20536}
20537const $a = {};
20538function ub(e) {
20539  if ($a[e] !== void 0)
20540    return $a[e];
20541  const t = e * 2 + 1, i = e * e, s = new Array(i + 1);
20542  for (let r = 0; r <= e; ++r)
20543    for (let o = 0; o <= e; ++o) {
20544      const a = r * r + o * o;
20545      if (a > i)
20546        break;
20547      let l = s[a];
20548      l || (l = [], s[a] = l), l.push(((e + r) * t + (e + o)) * 4 + 3), r > 0 && l.push(((e - r) * t + (e + o)) * 4 + 3), o > 0 && (l.push(((e + r) * t + (e - o)) * 4 + 3), r > 0 && l.push(((e - r) * t + (e - o)) * 4 + 3));
20549    }
20550  const n = [];
20551  for (let r = 0, o = s.length; r < o; ++r)
20552    s[r] && n.push(...s[r]);
20553  return $a[e] = n, n;
20554}
20555const Ku = cb;
20556class db extends Og {
20557  /**
20558   * @param {CanvasRenderingContext2D} context Context.
20559   * @param {number} pixelRatio Pixel ratio.
20560   * @param {import("../../extent.js").Extent} extent Extent.
20561   * @param {import("../../transform.js").Transform} transform Transform.
20562   * @param {number} viewRotation View rotation.
20563   * @param {number} [squaredTolerance] Optional squared tolerance for simplification.
20564   * @param {import("../../proj.js").TransformFunction} [userTransform] Transform from user to view projection.
20565   */
20566  constructor(t, i, s, n, r, o, a) {
20567    super(), this.context_ = t, this.pixelRatio_ = i, this.extent_ = s, this.transform_ = n, this.transformRotation_ = n ? Ir(Math.atan2(n[1], n[0]), 10) : 0, this.viewRotation_ = r, this.squaredTolerance_ = o, this.userTransform_ = a, this.contextFillState_ = null, this.contextStrokeState_ = null, this.contextTextState_ = null, this.fillState_ = null, this.strokeState_ = null, this.image_ = null, this.imageAnchorX_ = 0, this.imageAnchorY_ = 0, this.imageHeight_ = 0, this.imageOpacity_ = 0, this.imageOriginX_ = 0, this.imageOriginY_ = 0, this.imageRotateWithView_ = !1, this.imageRotation_ = 0, this.imageScale_ = [0, 0], this.imageWidth_ = 0, this.text_ = "", this.textOffsetX_ = 0, this.textOffsetY_ = 0, this.textRotateWithView_ = !1, this.textRotation_ = 0, this.textScale_ = [0, 0], this.textFillState_ = null, this.textStrokeState_ = null, this.textState_ = null, this.pixelCoordinates_ = [], this.tmpLocalTransform_ = Qe();
20568  }
20569  /**
20570   * @param {Array<number>} flatCoordinates Flat coordinates.
20571   * @param {number} offset Offset.
20572   * @param {number} end End.
20573   * @param {number} stride Stride.
20574   * @private
20575   */
20576  drawImages_(t, i, s, n) {
20577    if (!this.image_)
20578      return;
20579    const r = ps(
20580      t,
20581      i,
20582      s,
20583      n,
20584      this.transform_,
20585      this.pixelCoordinates_
20586    ), o = this.context_, a = this.tmpLocalTransform_, l = o.globalAlpha;
20587    this.imageOpacity_ != 1 && (o.globalAlpha = l * this.imageOpacity_);
20588    let h = this.imageRotation_;
20589    this.transformRotation_ === 0 && (h -= this.viewRotation_), this.imageRotateWithView_ && (h += this.viewRotation_);
20590    for (let c = 0, u = r.length; c < u; c += 2) {
20591      const d = r[c] - this.imageAnchorX_, f = r[c + 1] - this.imageAnchorY_;
20592      if (h !== 0 || this.imageScale_[0] != 1 || this.imageScale_[1] != 1) {
20593        const g = d + this.imageAnchorX_, _ = f + this.imageAnchorY_;
20594        si(
20595          a,
20596          g,
20597          _,
20598          1,
20599          1,
20600          h,
20601          -g,
20602          -_
20603        ), o.setTransform.apply(o, a), o.translate(g, _), o.scale(this.imageScale_[0], this.imageScale_[1]), o.drawImage(
20604          this.image_,
20605          this.imageOriginX_,
20606          this.imageOriginY_,
20607          this.imageWidth_,
20608          this.imageHeight_,
20609          -this.imageAnchorX_,
20610          -this.imageAnchorY_,
20611          this.imageWidth_,
20612          this.imageHeight_
20613        ), o.setTransform(1, 0, 0, 1, 0, 0);
20614      } else
20615        o.drawImage(
20616          this.image_,
20617          this.imageOriginX_,
20618          this.imageOriginY_,
20619          this.imageWidth_,
20620          this.imageHeight_,
20621          d,
20622          f,
20623          this.imageWidth_,
20624          this.imageHeight_
20625        );
20626    }
20627    this.imageOpacity_ != 1 && (o.globalAlpha = l);
20628  }
20629  /**
20630   * @param {Array<number>} flatCoordinates Flat coordinates.
20631   * @param {number} offset Offset.
20632   * @param {number} end End.
20633   * @param {number} stride Stride.
20634   * @private
20635   */
20636  drawText_(t, i, s, n) {
20637    if (!this.textState_ || this.text_ === "")
20638      return;
20639    this.textFillState_ && this.setContextFillState_(this.textFillState_), this.textStrokeState_ && this.setContextStrokeState_(this.textStrokeState_), this.setContextTextState_(this.textState_);
20640    const r = ps(
20641      t,
20642      i,
20643      s,
20644      n,
20645      this.transform_,
20646      this.pixelCoordinates_
20647    ), o = this.context_;
20648    let a = this.textRotation_;
20649    for (this.transformRotation_ === 0 && (a -= this.viewRotation_), this.textRotateWithView_ && (a += this.viewRotation_); i < s; i += n) {
20650      const l = r[i] + this.textOffsetX_, h = r[i + 1] + this.textOffsetY_;
20651      a !== 0 || this.textScale_[0] != 1 || this.textScale_[1] != 1 ? (o.translate(l - this.textOffsetX_, h - this.textOffsetY_), o.rotate(a), o.translate(this.textOffsetX_, this.textOffsetY_), o.scale(this.textScale_[0], this.textScale_[1]), this.textStrokeState_ && o.strokeText(this.text_, 0, 0
20651), this.textFillState_ && o.fillText(this.text_, 0, 0), o.setTransform(1, 0, 0, 1, 0, 0)) : (this.textStrokeState_ && o.strokeText(this.text_, l, h), this.textFillState_ && o.fillText(this.text_, l, h));
20652    }
20653  }
20654  /**
20655   * @param {Array<number>} flatCoordinates Flat coordinates.
20656   * @param {number} offset Offset.
20657   * @param {number} end End.
20658   * @param {number} stride Stride.
20659   * @param {boolean} close Close.
20660   * @private
20661   * @return {number} end End.
20662   */
20663  moveToLineTo_(t, i, s, n, r) {
20664    const o = this.context_, a = ps(
20665      t,
20666      i,
20667      s,
20668      n,
20669      this.transform_,
20670      this.pixelCoordinates_
20671    );
20672    o.moveTo(a[0], a[1]);
20673    let l = a.length;
20674    r && (l -= 2);
20675    for (let h = 2; h < l; h += 2)
20676      o.lineTo(a[h], a[h + 1]);
20677    return r && o.closePath(), s;
20678  }
20679  /**
20680   * @param {Array<number>} flatCoordinates Flat coordinates.
20681   * @param {number} offset Offset.
20682   * @param {Array<number>} ends Ends.
20683   * @param {number} stride Stride.
20684   * @private
20685   * @return {number} End.
20686   */
20687  drawRings_(t, i, s, n) {
20688    for (let r = 0, o = s.length; r < o; ++r)
20689      i = this.moveToLineTo_(
20690        t,
20691        i,
20692        s[r],
20693        n,
20694        !0
20695      );
20696    return i;
20697  }
20698  /**
20699   * Render a circle geometry into the canvas.  Rendering is immediate and uses
20700   * the current fill and stroke styles.
20701   *
20702   * @param {import("../../geom/Circle.js").default} geometry Circle geometry.
20703   * @api
20704   */
20705  drawCircle(t) {
20706    if (this.squaredTolerance_ && (t = /** @type {import("../../geom/Circle.js").default} */
20707    t.simplifyTransformed(
20708      this.squaredTolerance_,
20709      this.userTransform_
20710    )), !!ee(this.extent_, t.getExtent())) {
20711      if (this.fillState_ || this.strokeState_) {
20712        this.fillState_ && this.setContextFillState_(this.fillState_), this.strokeState_ && this.setContextStrokeState_(this.strokeState_);
20713        const i = jE(
20714          t,
20715          this.transform_,
20716          this.pixelCoordinates_
20717        ), s = i[2] - i[0], n = i[3] - i[1], r = Math.sqrt(s * s + n * n), o = this.context_;
20718        o.beginPath(), o.arc(
20719          i[0],
20720          i[1],
20721          r,
20722          0,
20723          2 * Math.PI
20724        ), this.fillState_ && o.fill(), this.strokeState_ && o.stroke();
20725      }
20726      this.text_ !== "" && this.drawText_(t.getCenter(), 0, 2, 2);
20727    }
20728  }
20729  /**
20730   * Set the rendering style.  Note that since this is an immediate rendering API,
20731   * any `zIndex` on the provided style will be ignored.
20732   *
20733   * @param {import("../../style/Style.js").default} style The rendering style.
20734   * @api
20735   */
20736  setStyle(t) {
20737    this.setFillStrokeStyle(t.getFill(), t.getStroke()), this.setImageStyle(t.getImage()), this.setTextStyle(t.getText());
20738  }
20739  /**
20740   * @param {import("../../transform.js").Transform} transform Transform.
20741   */
20742  setTransform(t) {
20743    this.transform_ = t;
20744  }
20745  /**
20746   * Render a geometry into the canvas.  Call
20747   * {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.
20748   *
20749   * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
20750   * @api
20751   */
20752  drawGeometry(t) {
20753    switch (t.getType()) {
20754      case "Point":
20755        this.drawPoint(
20756          /** @type {import("../../geom/Point.js").default} */
20757          t
20758        );
20759        break;
20760      case "LineString":
20761        this.drawLineString(
20762          /** @type {import("../../geom/LineString.js").default} */
20763          t
20764        );
20765        break;
20766      case "Polygon":
20767        this.drawPolygon(
20768          /** @type {import("../../geom/Polygon.js").default} */
20769          t
20770        );
20771        break;
20772      case "MultiPoint":
20773        this.drawMultiPoint(
20774          /** @type {import("../../geom/MultiPoint.js").default} */
20775          t
20776        );
20777        break;
20778      case "MultiLineString":
20779        this.drawMultiLineString(
20780          /** @type {import("../../geom/MultiLineString.js").default} */
20781          t
20782        );
20783        break;
20784      case "MultiPolygon":
20785        this.drawMultiPolygon(
20786          /** @type {import("../../geom/MultiPolygon.js").default} */
20787          t
20788        );
20789        break;
20790      case "GeometryCollection":
20791        this.drawGeometryCollection(
20792          /** @type {import("../../geom/GeometryCollection.js").default} */
20793          t
20794        );
20795        break;
20796      case "Circle":
20797        this.drawCircle(
20798          /** @type {import("../../geom/Circle.js").default} */
20799          t
20800        );
20801        break;
20802    }
20803  }
20804  /**
20805   * Render a feature into the canvas.  Note that any `zIndex` on the provided
20806   * style will be ignored - features are rendered immediately in the order that
20807   * this method is called.  If you need `zIndex` support, you should be using an
20808   * {@link module:ol/layer/Vector~VectorLayer} instead.
20809   *
20810   * @param {import("../../Feature.js").default} feature Feature.
20811   * @param {import("../../style/Style.js").default} style Style.
20812   * @api
20813   */
20814  drawFeature(t, i) {
20815    const s = i.getGeometryFunction()(t);
20816    s && (this.setStyle(i), this.drawGeometry(s));
20817  }
20818  /**
20819   * Render a GeometryCollection to the canvas.  Rendering is immediate and
20820   * uses the current styles appropriate for each geometry in the collection.
20821   *
20822   * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
20823   */
20824  drawGeometryCollection(t) {
20825    const i = t.getGeometriesArray();
20826    for (let s = 0, n = i.length; s < n; ++s)
20827      this.drawGeometry(i[s]);
20828  }
20829  /**
20830   * Render a Point geometry into the canvas.  Rendering is immediate and uses
20831   * the current style.
20832   *
20833   * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
20834   */
20835  drawPoint(t) {
20836    this.squaredTolerance_ && (t = /** @type {import("../../geom/Point.js").default} */
20837    t.simplifyTransformed(
20838      this.squaredTolerance_,
20839      this.userTransform_
20840    ));
20841    const i = t.getFlatCoordinates(), s = t.getStride();
20842    this.image_ && this.drawImages_(i, 0, i.length, s), this.text_ !== "" && this.drawText_(i, 0, i.length, s);
20843  }
20844  /**
20845   * Render a MultiPoint geometry  into the canvas.  Rendering is immediate and
20846   * uses the current style.
20847   *
20848   * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
20849   */
20850  drawMultiPoint(t) {
20851    this.squaredTolerance_ && (t = /** @type {import("../../geom/MultiPoint.js").default} */
20852    t.simplifyTransformed(
20853      this.squaredTolerance_,
20854      this.userTransform_
20855    ));
20856    const i = t.getFlatCoordinates(), s = t.getStride();
20857    this.image_ && this.drawImages_(i, 0, i.length, s), this.text_ !== "" && this.drawText_(i, 0, i.length, s);
20858  }
20859  /**
20860   * Render a LineString into the canvas.  Rendering is immediate and uses
20861   * the current style.
20862   *
20863   * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
20864   */
20865  drawLineString(t) {
20866    if (this.squaredTolerance_ && (t = /** @type {import("../../geom/LineString.js").default} */
20867    t.simplifyTransformed(
20868      this.squaredTolerance_,
20869      this.userTransform_
20870    )), !!ee(this.extent_, t.getExtent())) {
20871      if (this.strokeState_) {
20872        this.setContextStrokeState_(this.strokeState_);
20873        const i = this.context_, s = t.getFlatCoordinates();
20874        i.beginPath(), this.moveToLineTo_(
20875          s,
20876          0,
20877          s.length,
20878          t.getStride(),
20879          !1
20880        ), i.stroke();
20881      }
20882      if (this.text_ !== "") {
20883        const i = t.getFlatMidpoint();
20884        this.drawText_(i, 0, 2, 2);
20885      }
20886    }
20887  }
20888  /**
20889   * Render a MultiLineString geometry into the canvas.  Rendering is immediate
20890   * and uses the current style.
20891   *
20892   * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
20893   */
20894  drawMultiLineString(t) {
20895    this.squaredTolerance_ && (t = /** @type {import("../../geom/MultiLineString.js").default} */
20896    t.simplifyTransformed(
20897      this.squaredTolerance_,
20898      this.userTransform_
20899    ));
20900    const i = t.getExtent();
20901    if (ee(this.extent_, i)) {
20902      if (this.strokeState_) {
20903        this.setContextStrokeState_(this.strokeState_);
20904        const s = this.context_, n = t.getFlatCoordinates();
20905        let r = 0;
20906        const o = (
20907          /** @type {Array<number>} */
20908          t.getEnds()
20909        ), a = t.getStride();
20910        s.beginPath();
20911        for (let l = 0, h = o.length; l < h; ++l)
20912          r = this.moveToLineTo_(
20913            n,
20914            r,
20915            o[l],
20916            a,
20917            !1
20918          );
20919        s.stroke();
20920      }
20921      if (this.text_ !== "") {
20922        const s = t.getFlatMidpoints();
20923        this.drawText_(s, 0, s.length, 2);
20924      }
20925    }
20926  }
20927  /**
20928   * Render a Polygon geometry into the canvas.  Rendering is immediate and uses
20929   * the current style.
20930   *
20931   * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
20932   */
20933  drawPolygon(t) {
20934    if (this.squaredTolerance_ && (t = /** @type {import("../../geom/Polygon.js").default} */
20935    t.simplifyTransformed(
20936      this.squaredTolerance_,
20937      this.userTransform_
20938    )), !!ee(this.extent_, t.getExtent())) {
20939      if (this.strokeState_ || this.fillState_) {
20940        this.fillState_ && this.setContextFillState_(this.fillState_), this.strokeState_ && this.setContextStrokeState_(this.strokeState_);
20941        const i = this.context_;
20942        i.beginPath(), this.drawRings_(
20943          t.getOrientedFlatCoordinates(),
20944          0,
20945          /** @type {Array<number>} */
20946          t.getEnds(),
20947          t.getStride()
20948        ), this.fillState_ && i.fill(), this.strokeState_ && i.stroke();
20949      }
20950      if (this.text_ !== "") {
20951        const i = t.getFlatInteriorPoint();
20952        this.drawText_(i, 0, 2, 2);
20953      }
20954    }
20955  }
20956  /**
20957   * Render MultiPolygon geometry into the canvas.  Rendering is immediate and
20958   * uses the current style.
20959   * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
20960   */
20961  drawMultiPolygon(t) {
20962    if (this.squaredTolerance_ && (t = /** @type {import("../../geom/MultiPolygon.js").default} */
20963    t.simplifyTransformed(
20964      this.squaredTolerance_,
20965      this.userTransform_
20966    )), !!ee(this.extent_, t.getExtent())) {
20967      if (this.strokeState_ || this.fillState_) {
20968        this.fillState_ && this.setContextFillState_(this.fillState_), this.strokeState_ && this.setContextStrokeState_(this.strokeState_);
20969        const i = this.context_, s = t.getOrientedFlatCoordinates();
20970        let n = 0;
20971        const r = t.getEndss(), o = t.getStride();
20972        i.beginPath();
20973        for (let a = 0, l = r.length; a < l; ++a) {
20974          const h = r[a];
20975          n = this.drawRings_(s, n, h, o);
20976        }
20977        this.fillState_ && i.fill(), this.strokeState_ && i.stroke();
20978      }
20979      if (this.text_ !== "") {
20980        const i = t.getFlatInteriorPoints();
20981        this.drawText_(i, 0, i.length, 2);
20982      }
20983    }
20984  }
20985  /**
20986   * @param {import("../canvas.js").FillState} fillState Fill state.
20987   * @private
20988   */
20989  setContextFillState_(t) {
20990    const i = this.context_, s = this.contextFillState_;
20991    s ? s.fillStyle != t.fillStyle && (s.fillStyle = t.fillStyle, i.fillStyle = t.fillStyle) : (i.fillStyle = t.fillStyle, this.contextFillState_ = {
20992      fillStyle: t.fillStyle
20993    });
20994  }
20995  /**
20996   * @param {import("../canvas.js").StrokeState} strokeState Stroke state.
20997   * @private
20998   */
20999  setContextStrokeState_(t) {
21000    const i = this.context_, s = this.contextStrokeState_;
21001    s ? (s.lineCap != t.lineCap && (s.lineCap = t.lineCap, i.lineCap = t.lineCap), wi(s.lineDash, t.lineDash) || i.setLineDash(
21002      s.lineDash = t.lineDash
21003    ), s.lineDashOffset != t.lineDashOffset && (s.lineDashOffset = t.lineDashOffset, i.lineDashOffset = t.lineDashOffset), s.lineJoin != t.lineJoin && (s.lineJoin = t.lineJoin, i.lineJoin = t.lineJoin), s.lineWidth != t.lineWidth && (s.lineWidth = t.lineWidth, i.lineWidth = t.lineWidth), s.miterLimit != t.miter
21003Limit && (s.miterLimit = t.miterLimit, i.miterLimit = t.miterLimit), s.strokeStyle != t.strokeStyle && (s.strokeStyle = t.strokeStyle, i.strokeStyle = t.strokeStyle)) : (i.lineCap = t.lineCap, i.setLineDash(t.lineDash), i.lineDashOffset = t.lineDashOffset, i.lineJoin = t.lineJoin, i.lineWidth = t.lineWidth, i.miterLimit = t.miterLimit, i.strokeStyle = t.strokeStyle, this.contextStrokeState_ = {
21004      lineCap: t.lineCap,
21005      lineDash: t.lineDash,
21006      lineDashOffset: t.lineDashOffset,
21007      lineJoin: t.lineJoin,
21008      lineWidth: t.lineWidth,
21009      miterLimit: t.miterLimit,
21010      strokeStyle: t.strokeStyle
21011    });
21012  }
21013  /**
21014   * @param {import("../canvas.js").TextState} textState Text state.
21015   * @private
21016   */
21017  setContextTextState_(t) {
21018    const i = this.context_, s = this.contextTextState_, n = t.textAlign ? t.textAlign : _r;
21019    s ? (s.font != t.font && (s.font = t.font, i.font = t.font), s.textAlign != n && (s.textAlign = n, i.textAlign = n), s.textBaseline != t.textBaseline && (s.textBaseline = t.textBaseline, i.textBaseline = t.textBaseline)) : (i.font = t.font, i.textAlign = n, i.textBaseline = t.textBaseline, this.contextTextState_ = {
21020      font: t.font,
21021      textAlign: n,
21022      textBaseline: t.textBaseline
21023    });
21024  }
21025  /**
21026   * Set the fill and stroke style for subsequent draw operations.  To clear
21027   * either fill or stroke styles, pass null for the appropriate parameter.
21028   *
21029   * @param {import("../../style/Fill.js").default} fillStyle Fill style.
21030   * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
21031   */
21032  setFillStrokeStyle(t, i) {
21033    if (!t)
21034      this.fillState_ = null;
21035    else {
21036      const s = t.getColor();
21037      this.fillState_ = {
21038        fillStyle: Ze(
21039          s || xi
21040        )
21041      };
21042    }
21043    if (!i)
21044      this.strokeState_ = null;
21045    else {
21046      const s = i.getColor(), n = i.getLineCap(), r = i.getLineDash(), o = i.getLineDashOffset(), a = i.getLineJoin(), l = i.getWidth(), h = i.getMiterLimit(), c = r || ur;
21047      this.strokeState_ = {
21048        lineCap: n !== void 0 ? n : Do,
21049        lineDash: this.pixelRatio_ === 1 ? c : c.map((u) => u * this.pixelRatio_),
21050        lineDashOffset: (o || dr) * this.pixelRatio_,
21051        lineJoin: a !== void 0 ? a : wn,
21052        lineWidth: (l !== void 0 ? l : mr) * this.pixelRatio_,
21053        miterLimit: h !== void 0 ? h : fr,
21054        strokeStyle: Ze(
21055          s || gr
21056        )
21057      };
21058    }
21059  }
21060  /**
21061   * Set the image style for subsequent draw operations.  Pass null to remove
21062   * the image style.
21063   *
21064   * @param {import("../../style/Image.js").default} imageStyle Image style.
21065   */
21066  setImageStyle(t) {
21067    let i;
21068    if (!t || !(i = t.getSize())) {
21069      this.image_ = null;
21070      return;
21071    }
21072    const s = t.getPixelRatio(this.pixelRatio_), n = t.getAnchor(), r = t.getOrigin();
21073    this.image_ = t.getImage(this.pixelRatio_), this.imageAnchorX_ = n[0] * s, this.imageAnchorY_ = n[1] * s, this.imageHeight_ = i[1] * s, this.imageOpacity_ = t.getOpacity(), this.imageOriginX_ = r[0], this.imageOriginY_ = r[1], this.imageRotateWithView_ = t.getRotateWithView(), this.imageRotation_ = t.getRotation();
21074    const o = t.getScaleArray();
21075    this.imageScale_ = [
21076      o[0] * this.pixelRatio_ / s,
21077      o[1] * this.pixelRatio_ / s
21078    ], this.imageWidth_ = i[0] * s;
21079  }
21080  /**
21081   * Set the text style for subsequent draw operations.  Pass null to
21082   * remove the text style.
21083   *
21084   * @param {import("../../style/Text.js").default} textStyle Text style.
21085   */
21086  setTextStyle(t) {
21087    if (!t)
21088      this.text_ = "";
21089    else {
21090      const i = t.getFill();
21091      if (!i)
21092        this.textFillState_ = null;
21093      else {
21094        const f = i.getColor();
21095        this.textFillState_ = {
21096          fillStyle: Ze(
21097            f || xi
21098          )
21099        };
21100      }
21101      const s = t.getStroke();
21102      if (!s)
21103        this.textStrokeState_ = null;
21104      else {
21105        const f = s.getColor(), g = s.getLineCap(), _ = s.getLineDash(), m = s.getLineDashOffset(), p = s.getLineJoin(), y = s.getWidth(), v = s.getMiterLimit();
21106        this.textStrokeState_ = {
21107          lineCap: g !== void 0 ? g : Do,
21108          lineDash: _ || ur,
21109          lineDashOffset: m || dr,
21110          lineJoin: p !== void 0 ? p : wn,
21111          lineWidth: y !== void 0 ? y : mr,
21112          miterLimit: v !== void 0 ? v : fr,
21113          strokeStyle: Ze(
21114            f || gr
21115          )
21116        };
21117      }
21118      const n = t.getFont(), r = t.getOffsetX(), o = t.getOffsetY(), a = t.getRotateWithView(), l = t.getRotation(), h = t.getScaleArray(), c = t.getText(), u = t.getTextAlign(), d = t.getTextBaseline();
21119      this.textState_ = {
21120        font: n !== void 0 ? n : fg,
21121        textAlign: u !== void 0 ? u : _r,
21122        textBaseline: d !== void 0 ? d : No
21123      }, this.text_ = c !== void 0 ? Array.isArray(c) ? c.reduce((f, g, _) => f += _ % 2 ? " " : g, "") : c : "", this.textOffsetX_ = r !== void 0 ? this.pixelRatio_ * r : 0, this.textOffsetY_ = o !== void 0 ? this.pixelRatio_ * o : 0, this.textRotateWithView_ = a !== void 0 ? a : !1, this.textRotation_ = l !== void 0 ? l : 0, this.textScale_ = [
21124        this.pixelRatio_ * h[0],
21125        this.pixelRatio_ * h[1]
21126      ];
21127    }
21128  }
21129}
21130const fb = db, Ve = 0.5;
21131function gb(e, t, i, s, n, r, o) {
21132  const a = e[0] * Ve, l = e[1] * Ve, h = re(a, l);
21133  h.imageSmoothingEnabled = !1;
21134  const c = h.canvas, u = new fb(
21135    h,
21136    Ve,
21137    n,
21138    null,
21139    o
21140  ), d = i.length, f = Math.floor((256 * 256 * 256 - 1) / d), g = {};
21141  for (let m = 1; m <= d; ++m) {
21142    const p = i[m - 1], y = p.getStyleFunction() || s;
21143    if (!s)
21144      continue;
21145    let v = y(p, r);
21146    if (!v)
21147      continue;
21148    Array.isArray(v) || (v = [v]);
21149    const C = (m * f).toString(16).padStart(7, "#00000");
21150    for (let w = 0, O = v.length; w < O; ++w) {
21151      const R = v[w], j = R.getGeometryFunction()(p);
21152      if (!j || !ee(n, j.getExtent()))
21153        continue;
21154      const $ = R.clone(), V = $.getFill();
21155      V && V.setColor(C);
21156      const tt = $.getStroke();
21157      tt && (tt.setColor(C), tt.setLineDash(null)), $.setText(void 0);
21158      const J = R.getImage();
21159      if (J && J.getOpacity() !== 0) {
21160        const L = J.getImageSize();
21161        if (!L)
21162          continue;
21163        const W = re(
21164          L[0],
21165          L[1],
21166          void 0,
21167          { alpha: !1 }
21168        ), ut = W.canvas;
21169        W.fillStyle = C, W.fillRect(0, 0, ut.width, ut.height), $.setImage(
21170          new Lg({
21171            img: ut,
21172            imgSize: L,
21173            anchor: J.getAnchor(),
21174            anchorXUnits: "pixels",
21175            anchorYUnits: "pixels",
21176            offset: J.getOrigin(),
21177            opacity: 1,
21178            size: J.getSize(),
21179            scale: J.getScale(),
21180            rotation: J.getRotation(),
21181            rotateWithView: J.getRotateWithView()
21182          })
21183        );
21184      }
21185      const St = $.getZIndex() || 0;
21186      let K = g[St];
21187      K || (K = {}, g[St] = K, K.Polygon = [], K.Circle = [], K.LineString = [], K.Point = []);
21188      const Y = j.getType();
21189      if (Y === "GeometryCollection") {
21190        const L = (
21191          /** @type {import("../../geom/GeometryCollection.js").default} */
21192          j.getGeometriesArrayRecursive()
21193        );
21194        for (let W = 0, ut = L.length; W < ut; ++W) {
21195          const ft = L[W];
21196          K[ft.getType().replace("Multi", "")].push(
21197            ft,
21198            $
21199          );
21200        }
21201      } else
21202        K[Y.replace("Multi", "")].push(j, $);
21203    }
21204  }
21205  const _ = Object.keys(g).map(Number).sort(ws);
21206  for (let m = 0, p = _.length; m < p; ++m) {
21207    const y = g[_[m]];
21208    for (const v in y) {
21209      const E = y[v];
21210      for (let C = 0, w = E.length; C < w; C += 2) {
21211        u.setStyle(E[C + 1]);
21212        for (let O = 0, R = t.length; O < R; ++O)
21213          u.setTransform(t[O]), u.drawGeometry(E[C]);
21214      }
21215    }
21216  }
21217  return h.getImageData(0, 0, c.width, c.height);
21218}
21219function _b(e, t, i) {
21220  const s = [];
21221  if (i) {
21222    const n = Math.floor(Math.round(e[0]) * Ve), r = Math.floor(Math.round(e[1]) * Ve), o = (Ot(n, 0, i.width - 1) + Ot(r, 0, i.height - 1) * i.width) * 4, a = i.data[o], l = i.data[o + 1], c = i.data[o + 2] + 256 * (l + 256 * a), u = Math.floor((256 * 256 * 256 - 1) / t.length);
21223    c && c % u === 0 && s.push(t[c / u - 1]);
21224  }
21225  return s;
21226}
21227const mb = 0.5, Fg = {
21228  Point: wb,
21229  LineString: Mb,
21230  Polygon: Tb,
21231  MultiPoint: Sb,
21232  MultiLineString: Cb,
21233  MultiPolygon: bb,
21234  GeometryCollection: Eb,
21235  Circle: xb
21236};
21237function pb(e, t) {
21238  return parseInt(ot(e), 10) - parseInt(ot(t), 10);
21239}
21240function yb(e, t) {
21241  const i = Dl(e, t);
21242  return i * i;
21243}
21244function Dl(e, t) {
21245  return mb * e / t;
21246}
21247function xb(e, t, i, s, n) {
21248  const r = i.getFill(), o = i.getStroke();
21249  if (r || o) {
21250    const l = e.getBuilder(i.getZIndex(), "Circle");
21251    l.setFillStrokeStyle(r, o), l.drawCircle(t, s);
21252  }
21253  const a = i.getText();
21254  if (a && a.getText()) {
21255    const l = (n || e).getBuilder(
21256      i.getZIndex(),
21257      "Text"
21258    );
21259    l.setTextStyle(a), l.drawText(t, s);
21260  }
21261}
21262function qu(e, t, i, s, n, r, o) {
21263  let a = !1;
21264  const l = i.getImage();
21265  if (l) {
21266    const h = l.getImageState();
21267    h == rt.LOADED || h == rt.ERROR ? l.unlistenImageChange(n) : (h == rt.IDLE && l.load(), l.listenImageChange(n), a = !0);
21268  }
21269  return vb(
21270    e,
21271    t,
21272    i,
21273    s,
21274    r,
21275    o
21276  ), a;
21277}
21278function vb(e, t, i, s, n, r) {
21279  const o = i.getGeometryFunction()(t);
21280  if (!o)
21281    return;
21282  const a = o.simplifyTransformed(
21283    s,
21284    n
21285  );
21286  if (i.getRenderer())
21287    kg(e, a, i, t);
21288  else {
21289    const h = Fg[a.getType()];
21290    h(
21291      e,
21292      a,
21293      i,
21294      t,
21295      r
21296    );
21297  }
21298}
21299function kg(e, t, i, s) {
21300  if (t.getType() == "GeometryCollection") {
21301    const r = (
21302      /** @type {import("../geom/GeometryCollection.js").default} */
21303      t.getGeometries()
21304    );
21305    for (let o = 0, a = r.length; o < a; ++o)
21306      kg(e, r[o], i, s);
21307    return;
21308  }
21309  e.getBuilder(i.getZIndex(), "Default").drawCustom(
21310    /** @type {import("../geom/SimpleGeometry.js").default} */
21311    t,
21312    s,
21313    i.getRenderer(),
21314    i.getHitDetectionRenderer()
21315  );
21316}
21317function Eb(e, t, i, s, n) {
21318  const r = t.getGeometriesArray();
21319  let o, a;
21320  for (o = 0, a = r.length; o < a; ++o) {
21321    const l = Fg[r[o].getType()];
21322    l(
21323      e,
21324      r[o],
21325      i,
21326      s,
21327      n
21328    );
21329  }
21330}
21331function Mb(e, t, i, s, n) {
21332  const r = i.getStroke();
21333  if (r) {
21334    const a = e.getBuilder(
21335      i.getZIndex(),
21336      "LineString"
21337    );
21338    a.setFillStrokeStyle(null, r), a.drawLineString(t, s);
21339  }
21340  const o = i.getText();
21341  if (o && o.getText()) {
21342    const a = (n || e).getBuilder(
21343      i.getZIndex(),
21344      "Text"
21345    );
21346    a.setTextStyle(o), a.drawText(t, s);
21347  }
21348}
21349function Cb(e, t, i, s, n) {
21350  const r = i.getStroke();
21351  if (r) {
21352    const a = e.getBuilder(
21353      i.getZIndex(),
21354      "LineString"
21355    );
21356    a.setFillStrokeStyle(null, r), a.drawMultiLineString(t, s);
21357  }
21358  const o = i.getText();
21359  if (o && o.getText()) {
21360    const a = (n || e).getBuilder(
21361      i.getZIndex(),
21362      "Text"
21363    );
21364    a.setTextStyle(o), a.drawText(t, s);
21365  }
21366}
21367function bb(e, t, i, s, n) {
21368  const r = i.getFill(), o = i.getStroke();
21369  if (o || r) {
21370    const l = e.getBuilder(i.getZIndex(), "Polygon");
21371    l.setFillStrokeStyle(r, o), l.drawMultiPolygon(t, s);
21372  }
21373  const a = i.getText();
21374  if (a && a.getText()) {
21375    const l = (n || e).getBuilder(
21376      i.getZIndex(),
21377      "Text"
21378    );
21379    l.setTextStyle(a), l.drawText(t, s);
21380  }
21381}
21382function wb(e, t, i, s, n) {
21383  const r = i.getImage(), o = i.getText();
21384  let a;
21385  if (r) {
21386    if (r.getImageState() != rt.LOADED)
21387      return;
21388    let l = e;
21389    if (n) {
21390      const c = r.getDeclutterMode();
21391      if (c !== "none")
21392        if (l = n, c === "obstacle") {
21393          const u = e.getBuilder(
21394            i.getZIndex(),
21395            "Image"
21396          );
21397          u.setImageStyle(r, a), u.drawPoint(t, s);
21398        } else
21399          o && o.getText() && (a = {});
21400    }
21401    const h = l.getBuilder(
21402      i.getZIndex(),
21403      "Image"
21404    );
21405    h.setImageStyle(r, a), h.drawPoint(t, s);
21406  }
21407  if (o && o.getText()) {
21408    let l = e;
21409    n && (l = n);
21410    const h = l.getBuilder(i.getZIndex(), "Text");
21411    h.setTextStyle(o, a), h.drawText(t, s);
21412  }
21413}
21414function Sb(e, t, i, s, n) {
21415  const r = i.getImage(), o = i.getText();
21416  let a;
21417  if (r) {
21418    if (r.getImageState() != rt.LOADED)
21419      return;
21420    let l = e;
21421    if (n) {
21422      const c = r.getDeclutterMode();
21423      if (c !== "none")
21424        if (l = n, c === "obstacle") {
21425          const u = e.getBuilder(
21426            i.getZIndex(),
21427            "Image"
21428          );
21429          u.setImageStyle(r, a), u.drawMultiPoint(t, s);
21430        } else
21431          o && o.getText() && (a = {});
21432    }
21433    const h = l.getBuilder(
21434      i.getZIndex(),
21435      "Image"
21436    );
21437    h.setImageStyle(r, a), h.drawMultiPoint(t, s);
21438  }
21439  if (o && o.getText()) {
21440    let l = e;
21441    n && (l = n);
21442    const h = l.getBuilder(i.getZIndex(), "Text");
21443    h.setTextStyle(o, a), h.drawText(t, s);
21444  }
21445}
21446function Tb(e, t, i, s, n) {
21447  const r = i.getFill(), o = i.getStroke();
21448  if (r || o) {
21449    const l = e.getBuilder(i.getZIndex(), "Polygon");
21450    l.setFillStrokeStyle(r, o), l.drawPolygon(t, s);
21451  }
21452  const a = i.getText();
21453  if (a && a.getText()) {
21454    const l = (n || e).getBuilder(
21455      i.getZIndex(),
21456      "Text"
21457    );
21458    l.setTextStyle(a), l.drawText(t, s);
21459  }
21460}
21461class Rb extends ec {
21462  /**
21463   * @param {import("../../layer/BaseVector.js").default} vectorLayer Vector layer.
21464   */
21465  constructor(t) {
21466    super(t), this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this), this.animatingOrInteracting_, this.hitDetectionImageData_ = null, this.renderedFeatures_ = null, this.renderedRevision_ = -1, this.renderedResolution_ = NaN, this.renderedExtent_ = ve(), this.wrappedRenderedExtent_ = ve(), this.renderedRotation_, this.renderedCenter_ = null, this.renderedProjection_ = null, this.renderedRenderOrder_ = null, this.replayGroup_ = null, this.replayGroupChanged = !0, this.declutterExecutorGroup = null, this.clipping = !0, this.compositionContext_ = null, this.opacity_ = 1;
21467  }
21468  /**
21469   * @param {ExecutorGroup} executorGroup Executor group.
21470   * @param {import("../../Map.js").FrameState} frameState Frame state.
21471   * @param {import("rbush").default} [declutterTree] Declutter tree.
21472   */
21473  renderWorlds(t, i, s) {
21474    const n = i.extent, r = i.viewState, o = r.center, a = r.resolution, l = r.projection, h = r.rotation, c = l.getExtent(), u = this.getLayer().getSource(), d = i.pixelRatio, f = i.viewHints, g = !(f[Xt.ANIMATING] || f[Xt.INTERACTING]), _ = this.compositionContext_, m = Math.round(i.size[0] * d), p = Math.round(i.size[1] * d), y = u.getWrapX() && l.canWrapX(), v = y ? mt(c) : null, E = y ? Math.ceil((n[2] - c[2]) / v) + 1 : 1;
21475    let C = y ? Math.floor((n[0] - c[0]) / v) : 0;
21476    do {
21477      const w = this.getRenderTransform(
21478        o,
21479        a,
21480        h,
21481        d,
21482        m,
21483        p,
21484        C * v
21485      );
21486      t.execute(
21487        _,
21488        1,
21489        w,
21490        h,
21491        g,
21492        void 0,
21493        s
21494      );
21495    } while (++C < E);
21496  }
21497  setupCompositionContext_() {
21498    if (this.opacity_ !== 1) {
21499      const t = re(
21500        this.context.canvas.width,
21501        this.context.canvas.height,
21502        Xu
21503      );
21504      this.compositionContext_ = t;
21505    } else
21506      this.compositionContext_ = this.context;
21507  }
21508  releaseCompositionContext_() {
21509    if (this.opacity_ !== 1) {
21510      const t = this.context.globalAlpha;
21511      this.context.globalAlpha = this.opacity_, this.context.drawImage(this.compositionContext_.canvas, 0, 0), this.context.globalAlpha = t, pa(this.compositionContext_), Xu.push(this.compositionContext_.canvas), this.compositionContext_ = null;
21512    }
21513  }
21514  /**
21515   * Render declutter items for this layer
21516   * @param {import("../../Map.js").FrameState} frameState Frame state.
21517   */
21518  renderDeclutter(t) {
21519    this.declutterExecutorGroup && (this.setupCompositionContext_(), this.renderWorlds(
21520      this.declutterExecutorGroup,
21521      t,
21522      t.declutterTree
21523    ), this.releaseCompositionContext_());
21524  }
21525  /**
21526   * Render the layer.
21527   * @param {import("../../Map.js").FrameState} frameState Frame state.
21528   * @param {HTMLElement} target Target that may be used to render content to.
21529   * @return {HTMLElement} The rendered element.
21530   */
21531  renderFrame(t, i) {
21532    const s = t.pixelRatio, n = t.layerStatesArray[t.layerIndex];
21533    xE(this.pixelTransform, 1 / s, 1 / s), fa(this.inversePixelTransform, this.pixelTransform);
21534    const r = wh(this.pixelTransform);
21535    this.useContainer(i, r, this.getBackground(t));
21536    const o = this.context, a = o.canvas, l = this.replayGroup_, h = this.declutterExecutorGroup;
21537    if ((!l || l.isEmpty()) && (!h || h.isEmpty()))
21538      return null;
21539    const c = Math.round(t.size[0] * s), u = Math.round(t.size[1] * s);
21540    a.width != c || a.height != u ? (a.width = c, a.height = u, a.style.transform !== r && (a.style.transform = r)) : this.containerReused || o.clearRect(0, 0, c, u), this.preRender(o, t);
21541    const d = t.viewState;
21542    d.projection, this.opacity_ = n.opacity, this.setupCompositionContext_();
21543    let f = !1, g = !0;
21544    if (n.extent && this.clipping) {
21545      const _ = He(n.extent);
21546      g = ee(_, t.extent), f = g && !Gi(_, t.extent), f && this.clipUnrotated(this.compositionContext_, t, _);
21547    }
21548    return g && this.renderWorlds(l, t), f && this.compositionContext_.restore(), this.releaseCompositionContext_(), this.postRender(o, t), this.renderedRotation_ !== d.rotation && (this.renderedRotation_ = d.rotation, this.hitDetectionImageData_ = null), this.container;
21549  }
21550  /**
21551   * Asynchronous layer level hit detection.
21552   * @param {import("../../pixel.js").Pixel} pixel Pixel.
21553   * @return {Promise<Array<import("../../Feature").default>>} Promise
21554   * that resolves with an array of features.
21555   */
21556  getFeatures(t) {
21557    return new Promise((i) => {
21558      if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
21559        const s = [this.context.canvas.width, this.context.canvas.height];
21560        zt(this.pixelTransform, s);
21561        const n = this.renderedCenter_, r = this.renderedResolution_, o = this.renderedRotation_, a = this.renderedProjection_, l = this.wrappedRenderedExtent_, h = this.getLayer(), c = [], u = s[0] * Ve, d = s[1] * Ve;
21562        c.push(
21563          this.getRenderTransform(
21564            n,
21565            r,
21566            o,
21567            Ve,
21568            u,
21569            d,
21570            0
21571          ).slice()
21572        );
21573        const f = h.getSource(), g = a.getExtent();
21574        if (f.getWrapX() && a.canWrapX() && !Gi(g, l)) {
21575          let _ = l[0];
21576          const m = mt(g);
21577          let p = 0, y;
21578          for (; _ < g[0]; )
21579            --p, y = m * p, c.push(
21580              this.getRenderTransform(
21581                n,
21582                r,
21583                o,
21584                Ve,
21585                u,
21586                d,
21587                y
21588              ).slice()
21589            ), _ += m;
21590          for (p = 0, _ = l[2]; _ > g[2]; )
21591            ++p, y = m * p, c.push(
21592              this.getRenderTransform(
21593                n,
21594                r,
21595                o,
21596                Ve,
21597                u,
21598                d,
21599                y
21600              ).slice()
21601            ), _ -= m;
21602        }
21603        this.hitDetectionImageData_ = gb(
21604          s,
21605          c,
21606          this.renderedFeatures_,
21607          h.getStyleFunction(),
21608          l,
21609          r,
21610          o
21611        );
21612      }
21613      i(
21614        _b(t, this.renderedFeatures_, this.hitDetectionImageData_)
21615      );
21616    });
21617  }
21618  /**
21619   * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
21620   * @param {import("../../Map.js").FrameState} frameState Frame state.
21621   * @param {number} hitTolerance Hit tolerance in pixels.
21622   * @param {import("../vector.js").FeatureCallback<T>} callback Feature callback.
21623   * @param {Array<import("../Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
21624   * @return {T|undefined} Callback result.
21625   * @template T
21626   */
21627  forEachFeatureAtCoordinate(t, i, s, n, r) {
21628    if (!this.replayGroup_)
21629      return;
21630    const o = i.viewState.resolution, a = i.viewState.rotation, l = this.getLayer(), h = {}, c = function(f, g, _) {
21631      const m = ot(f), p = h[m];
21632      if (p) {
21633        if (p !== !0 && _ < p.distanceSq) {
21634          if (_ === 0)
21635            return h[m] = !0, r.splice(r.lastIndexOf(p), 1), n(f, l, g);
21636          p.geometry = g, p.distanceSq = _;
21637        }
21638      } else {
21639        if (_ === 0)
21640          return h[m] = !0, n(f, l, g);
21641        r.push(
21642          h[m] = {
21643            feature: f,
21644            layer: l,
21645            geometry: g,
21646            distanceSq: _,
21647            callback: n
21648          }
21649        );
21650      }
21651    };
21652    let u;
21653    const d = [this.replayGroup_];
21654    return this.declutterExecutorGroup && d.push(this.declutterExecutorGroup), d.some((f) => u = f.forEachFeatureAtCoordinate(
21655      t,
21656      o,
21657      a,
21658      s,
21659      c,
21660      f === this.declutterExecutorGroup && i.declutterTree ? i.declutterTree.all().map((g) => g.value) : null
21661    )), u;
21662  }
21663  /**
21664   * Perform action necessary to get the layer rendered after new fonts have loaded
21665   */
21666  handleFontsChanged() {
21667    const t = this.getLayer();
21668    t.getVisible() && this.replayGroup_ && t.changed();
21669  }
21670  /**
21671   * Handle changes in image style state.
21672   * @param {import("../../events/Event.js").default} event Image style change event.
21673   * @private
21674   */
21675  handleStyleImageChange_(t) {
21676    this.renderIfReadyAndVisible();
21677  }
21678  /**
21679   * Determine whether render should be called.
21680   * @param {import("../../Map.js").FrameState} frameState Frame state.
21681   * @return {boolean} Layer is ready to be rendered.
21682   */
21683  prepareFrame(t) {
21684    const i = this.getLayer(), s = i.getSource();
21685    if (!s)
21686      return !1;
21687    const n = t.viewHints[Xt.ANIMATING], r = t.viewHints[Xt.INTERACTING], o = i.getUpdateWhileAnimating(), a = i.getUpdateWhileInteracting();
21688    if (this.ready && !o && n || !a && r)
21689      return this.animatingOrInteracting_ = !0, !0;
21690    this.animatingOrInteracting_ = !1;
21691    const l = t.extent, h = t.viewState, c = h.projection, u = h.resolution, d = t.pixelRatio, f = i.getRevision(), g = i.getRenderBuffer();
21692    let _ = i.getRenderOrder();
21693    _ === void 0 && (_ = pb);
21694    const m = h.center.slice(), p = Ms(
21695      l,
21696      g * u
21697    ), y = p.slice(), v = [p.slice()], E = c.getExtent();
21698    if (s.getWrapX() && c.canWrapX() && !Gi(E, t.extent)) {
21699      const K = mt(E), Y = Math.max(mt(p) / 2, K);
21700      p[0] = E[0] - Y, p[2] = E[2] + Y, Xd(m, c);
21701      const L = Bd(v[0], c);
21702      L[0] < E[0] && L[2] < E[2] ? v.push([
21703        L[0] + K,
21704        L[1],
21705        L[2] + K,
21706        L[3]
21707      ]) : L[0] > E[0] && L[2] > E[2] && v.push([
21708        L[0] - K,
21709        L[1],
21710        L[2] - K,
21711        L[3]
21712      ]);
21713    }
21714    if (this.ready && this.renderedResolution_ == u && this.renderedRevision_ == f && this.renderedRenderOrder_ == _ && Gi(this.wrappedRenderedExtent_, p))
21715      return wi(this.renderedExtent_, y) || (this.hitDetectionImageData_ = null, this.renderedExtent_ = y), this.renderedCenter_ = m, this.replayGroupChanged = !1, !0;
21716    this.replayGroup_ = null;
21717    const C = new Uu(
21718      Dl(u, d),
21719      p,
21720      u,
21721      d
21722    );
21723    let w;
21724    this.getLayer().getDeclutter() && (w = new Uu(
21725      Dl(u, d),
21726      p,
21727      u,
21728      d
21729    ));
21730    let O;
21731    for (let K = 0, Y = v.length; K < Y; ++K)
21732      s.loadFeatures(v[K], u, c);
21733    const R = yb(u, d);
21734    let j = !0;
21735    const $ = (
21736      /**
21737       * @param {import("../../Feature.js").default} feature Feature.
21738       */
21739      (K) => {
21740        let Y;
21741        const L = K.getStyleFunction() || i.getStyleFunction();
21742        if (L && (Y = L(K, u)), Y) {
21743          const W = this.renderFeature(
21744            K,
21745            R,
21746            Y,
21747            C,
21748            O,
21749            w
21750          );
21751          j = j && !W;
21752        }
21753      }
21754    ), V = Qo(p), tt = s.getFeaturesInExtent(V);
21755    _ && tt.sort(_);
21756    for (let K = 0, Y = tt.length; K < Y; ++K)
21757      $(tt[K]);
21758    this.renderedFeatures_ = tt, this.ready = j;
21759    const J = C.finish(), St = new Ku(
21760      p,
21761      u,
21762      d,
21763      s.getOverlaps(),
21764      J,
21765      i.getRenderBuffer()
21766    );
21767    return w && (this.declutterExecutorGroup = new Ku(
21768      p,
21769      u,
21770      d,
21771      s.getOverlaps(),
21772      w.finish(),
21773      i.getRenderBuffer()
21774    )), this.renderedResolution_ = u, this.renderedRevision_ = f, this.renderedRenderOrder_ = _, this.renderedExtent_ = y, this.wrappedRenderedExtent_ = p, this.renderedCenter_ = m, this.renderedProjection_ = c, this.replayGroup_ = St, this.hitDetectionImageData_ = null, this.replayGroupChanged = !0, !0;
21775  }
21776  /**
21777   * @param {import("../../Feature.js").default} feature Feature.
21778   * @param {number} squaredTolerance Squared render tolerance.
21779   * @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
21780   * @param {import("../../render/canvas/BuilderGroup.js").default} builderGroup Builder group.
21781   * @param {import("../../proj.js").TransformFunction} [transform] Transform from user to view projection.
21782   * @param {import("../../render/canvas/BuilderGroup.js").default} [declutterBuilderGroup] Builder for decluttering.
21783   * @return {boolean} `true` if an image is loading.
21784   */
21785  renderFeature(t, i, s, n, r, o) {
21786    if (!s)
21787      return !1;
21788    let a = !1;
21789    if (Array.isArray(s))
21790      for (let l = 0, h = s.length; l < h; ++l)
21791        a = qu(
21792          n,
21793          t,
21794          s[l],
21795          i,
21796          this.boundHandleStyleImageChange_,
21797          r,
21798          o
21799        ) || a;
21800    else
21801      a = qu(
21802        n,
21803        t,
21804        s,
21805        i,
21806        this.boundHandleStyleImageChange_,
21807        r,
21808        o
21809      );
21810    return a;
21811  }
21812}
21813const Ib = Rb;
21814class Pb extends BC {
21815  /**
21816   * @param {import("./BaseVector.js").Options<VectorSourceType>} [options] Options.
21817   */
21818  constructor(t) {
21819    super(t);
21820  }
21821  createRenderer() {
21822    return new Ib(this);
21823  }
21824}
21825const xa = Pb;
21826class Ab {
21827  /**
21828   * @param {number} [maxEntries] Max entries.
21829   */
21830  constructor(t) {
21831    this.rbush_ = new Pg(t), this.items_ = {};
21832  }
21833  /**
21834   * Insert a value into the RBush.
21835   * @param {import("../extent.js").Extent} extent Extent.
21836   * @param {T} value Value.
21837   */
21838  insert(t, i) {
21839    const s = {
21840      minX: t[0],
21841      minY: t[1],
21842      maxX: t[2],
21843      maxY: t[3],
21844      value: i
21845    };
21846    this.rbush_.insert(s), this.items_[ot(i)] = s;
21847  }
21848  /**
21849   * Bulk-insert values into the RBush.
21850   * @param {Array<import("../extent.js").Extent>} extents Extents.
21851   * @param {Array<T>} values Values.
21852   */
21853  load(t, i) {
21854    const s = new Array(i.length);
21855    for (let n = 0, r = i.length; n < r; n++) {
21856      const o = t[n], a = i[n], l = {
21857        minX: o[0],
21858        minY: o[1],
21859        maxX: o[2],
21860        maxY: o[3],
21861        value: a
21862      };
21863      s[n] = l, this.items_[ot(a)] = l;
21864    }
21865    this.rbush_.load(s);
21866  }
21867  /**
21868   * Remove a value from the RBush.
21869   * @param {T} value Value.
21870   * @return {boolean} Removed.
21871   */
21872  remove(t) {
21873    const i = ot(t), s = this.items_[i];
21874    return delete this.items_[i], this.rbush_.remove(s) !== null;
21875  }
21876  /**
21877   * Update the extent of a value in the RBush.
21878   * @param {import("../extent.js").Extent} extent Extent.
21879   * @param {T} value Value.
21880   */
21881  update(t, i) {
21882    const s = this.items_[ot(i)], n = [s.minX, s.minY, s.maxX, s.maxY];
21883    pn(n, t) || (this.remove(i), this.insert(t, i));
21884  }
21885  /**
21886   * Return all values in the RBush.
21887   * @return {Array<T>} All.
21888   */
21889  getAll() {
21890    return this.rbush_.all().map(function(i) {
21891      return i.value;
21892    });
21893  }
21894  /**
21895   * Return all values in the given extent.
21896   * @param {import("../extent.js").Extent} extent Extent.
21897   * @return {Array<T>} All in extent.
21898   */
21899  getInExtent(t) {
21900    const i = {
21901      minX: t[0],
21902      minY: t[1],
21903      maxX: t[2],
21904      maxY: t[3]
21905    };
21906    return this.rbush_.search(i).map(function(n) {
21907      return n.value;
21908    });
21909  }
21910  /**
21911   * Calls a callback function with each value in the tree.
21912   * If the callback returns a truthy value, this value is returned without
21913   * checking the rest of the tree.
21914   * @param {function(T): *} callback Callback.
21915   * @return {*} Callback return value.
21916   */
21917  forEach(t) {
21918    return this.forEach_(this.getAll(), t);
21919  }
21920  /**
21921   * Calls a callback function with each value in the provided extent.
21922   * @param {import("../extent.js").Extent} extent Extent.
21923   * @param {function(T): *} callback Callback.
21924   * @return {*} Callback return value.
21925   */
21926  forEachInExtent(t, i) {
21927    return this.forEach_(this.getInExtent(t), i);
21928  }
21929  /**
21930   * @param {Array<T>} values Values.
21931   * @param {function(T): *} callback Callback.
21932   * @private
21933   * @return {*} Callback return value.
21934   */
21935  forEach_(t, i) {
21936    let s;
21937    for (let n = 0, r = t.length; n < r; n++)
21938      if (s = i(t[n]), s)
21939        return s;
21940    return s;
21941  }
21942  /**
21943   * @return {boolean} Is empty.
21944   */
21945  isEmpty() {
21946    return _n(this.items_);
21947  }
21948  /**
21949   * Remove all values from the RBush.
21950   */
21951  clear() {
21952    this.rbush_.clear(), this.items_ = {};
21953  }
21954  /**
21955   * @param {import("../extent.js").Extent} [extent] Extent.
21956   * @return {import("../extent.js").Extent} Extent.
21957   */
21958  getExtent(t) {
21959    const i = this.rbush_.toJSON();
21960    return ei(i.minX, i.minY, i.maxX, i.maxY, t);
21961  }
21962  /**
21963   * @param {RBush} rbush R-Tree.
21964   */
21965  concat(t) {
21966    this.rbush_.load(t.rbush_.all());
21967    for (const i in t.items_)
21968      this.items_[i] = t.items_[i];
21969  }
21970}
21971const Bo = Ab;
21972class Lb extends ni {
21973  /**
21974   * @param {Options} options Source options.
21975   */
21976  constructor(t) {
21977    super(), this.projection = Rt(t.projection), this.attributions_ = Vu(t.attributions), this.attributionsCollapsible_ = t.attributionsCollapsible !== void 0 ? t.attributionsCollapsible : !0, this.loading = !1, this.state_ = t.state !== void 0 ? t.state : "ready", this.wrapX_ = t.wrapX !== void 0 ? t.wrapX : !1, this.interpolate_ = !!t.interpolate, this.viewResolver = null, this.viewRejector = null;
21978    const i = this;
21979    this.viewPromise_ = new Promise(function(s, n) {
21980      i.viewResolver = s, i.viewRejector = n;
21981    });
21982  }
21983  /**
21984   * Get the attribution function for the source.
21985   * @return {?Attribution} Attribution function.
21986   * @api
21987   */
21988  getAttributions() {
21989    return this.attributions_;
21990  }
21991  /**
21992   * @return {boolean} Attributions are collapsible.
21993   * @api
21994   */
21995  getAttributionsCollapsible() {
21996    return this.attributionsCollapsible_;
21997  }
21998  /**
21999   * Get the projection of the source.
22000   * @return {import("../proj/Projection.js").default|null} Projection.
22001   * @api
22002   */
22003  getProjection() {
22004    return this.projection;
22005  }
22006  /**
22007   * @param {import("../proj/Projection").default} [projection] Projection.
22008   * @return {Array<number>|null} Resolutions.
22009   */
22010  getResolutions(t) {
22011    return null;
22012  }
22013  /**
22014   * @return {Promise<import("../View.js").ViewOptions>} A promise for view-related properties.
22015   */
22016  getView() {
22017    return this.viewPromise_;
22018  }
22019  /**
22020   * Get the state of the source, see {@link import("./Source.js").State} for possible states.
22021   * @return {import("./Source.js").State} State.
22022   * @api
22023   */
22024  getState() {
22025    return this.state_;
22026  }
22027  /**
22028   * @return {boolean|undefined} Wrap X.
22029   */
22030  getWrapX() {
22031    return this.wrapX_;
22032  }
22033  /**
22034   * @return {boolean} Use linear interpolation when resampling.
22035   */
22036  getInterpolate() {
22037    return this.interpolate_;
22038  }
22039  /**
22040   * Refreshes the source. The source will be cleared, and data from the server will be reloaded.
22041   * @api
22042   */
22043  refresh() {
22044    this.changed();
22045  }
22046  /**
22047   * Set the attributions of the source.
22048   * @param {AttributionLike|undefined} attributions Attributions.
22049   *     Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},
22050   *     or `undefined`.
22051   * @api
22052   */
22053  setAttributions(t) {
22054    this.attributions_ = Vu(t), this.changed();
22055  }
22056  /**
22057   * Set the state of the source.
22058   * @param {import("./Source.js").State} state State.
22059   */
22060  setState(t) {
22061    this.state_ = t, this.changed();
22062  }
22063}
22064function Vu(e) {
22065  return e ? Array.isArray(e) ? function(t) {
22066    return e;
22067  } : typeof e == "function" ? e : function(t) {
22068    return [e];
22069  } : null;
22070}
22071const ic = Lb, le = {
22072  /**
22073   * Triggered when a feature is added to the source.
22074   * @event module:ol/source/Vector.VectorSourceEvent#addfeature
22075   * @api
22076   */
22077  ADDFEATURE: "addfeature",
22078  /**
22079   * Triggered when a feature is updated.
22080   * @event module:ol/source/Vector.VectorSourceEvent#changefeature
22081   * @api
22082   */
22083  CHANGEFEATURE: "changefeature",
22084  /**
22085   * Triggered when the clear method is called on the source.
22086   * @event module:ol/source/Vector.VectorSourceEvent#clear
22087   * @api
22088   */
22089  CLEAR: "clear",
22090  /**
22091   * Triggered when a feature is removed from the source.
22092   * See {@link module:ol/source/Vector~VectorSource#clear source.clear()} for exceptions.
22093   * @event module:ol/source/Vector.VectorSourceEvent#removefeature
22094   * @api
22095   */
22096  REMOVEFEATURE: "removefeature",
22097  /**
22098   * Triggered when features starts loading.
22099   * @event module:ol/source/Vector.VectorSourceEvent#featuresloadstart
22100   * @api
22101   */
22102  FEATURESLOADSTART: "featuresloadstart",
22103  /**
22104   * Triggered when features finishes loading.
22105   * @event module:ol/source/Vector.VectorSourceEvent#featuresloadend
22106   * @api
22107   */
22108  FEATURESLOADEND: "featuresloadend",
22109  /**
22110   * Triggered if feature loading results in an error.
22111   * @event module:ol/source/Vector.VectorSourceEvent#featuresloaderror
22112   * @api
22113   */
22114  FEATURESLOADERROR: "featuresloaderror"
22115};
22116function Ob(e, t) {
22117  return [[-1 / 0, -1 / 0, 1 / 0, 1 / 0]];
22118}
22119let Fb = !1;
22120function kb(e, t, i, s, n, r, o) {
22121  const a = new XMLHttpRequest();
22122  a.open(
22123    "GET",
22124    typeof e == "function" ? e(i, s, n) : e,
22125    !0
22126  ), t.getType() == "arraybuffer" && (a.responseType = "arraybuffer"), a.withCredentials = Fb, a.onload = function(l) {
22127    if (!a.status || a.status >= 200 && a.status < 300) {
22128      const h = t.getType();
22129      let c;
22130      h == "json" || h == "text" ? c = a.responseText : h == "xml" ? (c = a.responseXML, c || (c = new DOMParser().parseFromString(
22131        a.responseText,
22132        "application/xml"
22133      ))) : h == "arraybuffer" && (c = /** @type {ArrayBuffer} */
22134      a.response), c ? r(
22135        /** @type {Array<import("./Feature.js").default>} */
22136        t.readFeatures(c, {
22137          extent: i,
22138          featureProjection: n
22139        }),
22140        t.readProjection(c)
22141      ) : o();
22142    } else
22143      o();
22144  }, a.onerror = o, a.send();
22145}
22146function Hu(e, t) {
22147  return function(i, s, n, r, o) {
22148    const a = (
22149      /** @type {import("./source/Vector").default} */
22150      this
22151    );
22152    kb(
22153      e,
22154      t,
22155      i,
22156      s,
22157      n,
22158      /**
22159       * @param {Array<import("./Feature.js").default>} features The loaded features.
22160       * @param {import("./proj/Projection.js").default} dataProjection Data
22161       * projection.
22162       */
22163      function(l, h) {
22164        a.addFeatures(l), r !== void 0 && r(l);
22165      },
22166      /* FIXME handle error */
22167      o || Mn
22168    );
22169  };
22170}
22171class Pi extends Ae {
22172  /**
22173   * @param {string} type Type.
22174   * @param {import("../Feature.js").default<Geometry>} [feature] Feature.
22175   * @param {Array<import("../Feature.js").default<Geometry>>} [features] Features.
22176   */
22177  constructor(t, i, s) {
22178    super(t), this.feature = i, this.features = s;
22179  }
22180}
22181class Db extends ic {
22182  /**
22183   * @param {Options<Geometry>} [options] Vector source options.
22184   */
22185  constructor(t) {
22186    t = t || {}, super({
22187      attributions: t.attributions,
22188      interpolate: !0,
22189      projection: void 0,
22190      state: "ready",
22191      wrapX: t.wrapX !== void 0 ? t.wrapX : !0
22192    }), this.on, this.once, this.un, this.loader_ = Mn, this.format_ = t.format, this.overlaps_ = t.overlaps === void 0 ? !0 : t.overlaps, this.url_ = t.url, t.loader !== void 0 ? this.loader_ = t.loader : this.url_ !== void 0 && (at(this.format_, 7), this.loader_ = Hu(
22193      this.url_,
22194      /** @type {import("../format/Feature.js").default} */
22195      this.format_
22196    )), this.strategy_ = t.strategy !== void 0 ? t.strategy : Ob;
22197    const i = t.useSpatialIndex !== void 0 ? t.useSpatialIndex : !0;
22198    this.featuresRtree_ = i ? new Bo() : null, this.loadedExtentsRtree_ = new Bo(), this.loadingExtentsCount_ = 0, this.nullGeometryFeatures_ = {}, this.idIndex_ = {}, this.uidIndex_ = {}, this.featureChangeKeys_ = {}, this.featuresCollection_ = null;
22199    let s, n;
22200    Array.isArray(t.features) ? n = t.features : t.features && (s = t.features, n = s.getArray()), !i && s === void 0 && (s = new Pe(n)), n !== void 0 && this.addFeaturesInternal(n), s !== void 0 && this.bindFeaturesCollection_(s);
22201  }
22202  /**
22203   * Add a single feature to the source.  If you want to add a batch of features
22204   * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}
22205   * instead. A feature will not be added to the source if feature with
22206   * the same id is already there. The reason for this behavior is to avoid
22207   * feature duplication when using bbox or tile loading strategies.
22208   * Note: this also applies if an {@link module:ol/Collection~Collection} is used for features,
22209   * meaning that if a feature with a duplicate id is added in the collection, it will
22210   * be removed from it right away.
22211   * @param {import("../Feature.js").default<Geometry>} feature Feature to add.
22212   * @api
22213   */
22214  addFeature(t) {
22215    this.addFeatureInternal(t), this.changed();
22216  }
22217  /**
22218   * Add a feature without firing a `change` event.
22219   * @param {import("../Feature.js").default<Geometry>} feature Feature.
22220   * @protected
22221   */
22222  addFeatureInternal(t) {
22223    const i = ot(t);
22224    if (!this.addToIndex_(i, t)) {
22225      this.featuresCollection_ && this.featuresCollection_.remove(t);
22226      return;
22227    }
22228    this.setupChangeEvents_(i, t);
22229    const s = t.getGeometry();
22230    if (s) {
22231      const n = s.getExtent();
22232      this.featuresRtree_ && this.featuresRtree_.insert(n, t);
22233    } else
22234      this.nullGeometryFeatures_[i] = t;
22235    this.dispatchEvent(
22236      new Pi(le.ADDFEATURE, t)
22237    );
22238  }
22239  /**
22240   * @param {s
22240tring} featureKey Unique identifier for the feature.
22241   * @param {import("../Feature.js").default<Geometry>} feature The feature.
22242   * @private
22243   */
22244  setupChangeEvents_(t, i) {
22245    this.featureChangeKeys_[t] = [
22246      lt(i, et.CHANGE, this.handleFeatureChange_, this),
22247      lt(
22248        i,
22249        En.PROPERTYCHANGE,
22250        this.handleFeatureChange_,
22251        this
22252      )
22253    ];
22254  }
22255  /**
22256   * @param {string} featureKey Unique identifier for the feature.
22257   * @param {import("../Feature.js").default<Geometry>} feature The feature.
22258   * @return {boolean} The feature is "valid", in the sense that it is also a
22259   *     candidate for insertion into the Rtree.
22260   * @private
22261   */
22262  addToIndex_(t, i) {
22263    let s = !0;
22264    const n = i.getId();
22265    return n !== void 0 && (n.toString() in this.idIndex_ ? s = !1 : this.idIndex_[n.toString()] = i), s && (at(!(t in this.uidIndex_), 30), this.uidIndex_[t] = i), s;
22266  }
22267  /**
22268   * Add a batch of features to the source.
22269   * @param {Array<import("../Feature.js").default<Geometry>>} features Features to add.
22270   * @api
22271   */
22272  addFeatures(t) {
22273    this.addFeaturesInternal(t), this.changed();
22274  }
22275  /**
22276   * Add features without firing a `change` event.
22277   * @param {Array<import("../Feature.js").default<Geometry>>} features Features.
22278   * @protected
22279   */
22280  addFeaturesInternal(t) {
22281    const i = [], s = [], n = [];
22282    for (let r = 0, o = t.length; r < o; r++) {
22283      const a = t[r], l = ot(a);
22284      this.addToIndex_(l, a) && s.push(a);
22285    }
22286    for (let r = 0, o = s.length; r < o; r++) {
22287      const a = s[r], l = ot(a);
22288      this.setupChangeEvents_(l, a);
22289      const h = a.getGeometry();
22290      if (h) {
22291        const c = h.getExtent();
22292        i.push(c), n.push(a);
22293      } else
22294        this.nullGeometryFeatures_[l] = a;
22295    }
22296    if (this.featuresRtree_ && this.featuresRtree_.load(i, n), this.hasListener(le.ADDFEATURE))
22297      for (let r = 0, o = s.length; r < o; r++)
22298        this.dispatchEvent(
22299          new Pi(le.ADDFEATURE, s[r])
22300        );
22301  }
22302  /**
22303   * @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection.
22304   * @private
22305   */
22306  bindFeaturesCollection_(t) {
22307    let i = !1;
22308    this.addEventListener(
22309      le.ADDFEATURE,
22310      /**
22311       * @param {VectorSourceEvent<Geometry>} evt The vector source event
22312       */
22313      function(s) {
22314        i || (i = !0, t.push(s.feature), i = !1);
22315      }
22316    ), this.addEventListener(
22317      le.REMOVEFEATURE,
22318      /**
22319       * @param {VectorSourceEvent<Geometry>} evt The vector source event
22320       */
22321      function(s) {
22322        i || (i = !0, t.remove(s.feature), i = !1);
22323      }
22324    ), t.addEventListener(
22325      $t.ADD,
22326      /**
22327       * @param {import("../Collection.js").CollectionEvent<import("../Feature.js").default<Geometry>>} evt The collection event
22328       */
22329      (s) => {
22330        i || (i = !0, this.addFeature(s.element), i = !1);
22331      }
22332    ), t.addEventListener(
22333      $t.REMOVE,
22334      /**
22335       * @param {import("../Collection.js").CollectionEvent<import("../Feature.js").default<Geometry>>} evt The collection event
22336       */
22337      (s) => {
22338        i || (i = !0, this.removeFeature(s.element), i = !1);
22339      }
22340    ), this.featuresCollection_ = t;
22341  }
22342  /**
22343   * Remove all features from the source.
22344   * @param {boolean} [fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature} events.
22345   * @api
22346   */
22347  clear(t) {
22348    if (t) {
22349      for (const s in this.featureChangeKeys_)
22350        this.featureChangeKeys_[s].forEach(Mt);
22351      this.featuresCollection_ || (this.featureChangeKeys_ = {}, this.idIndex_ = {}, this.uidIndex_ = {});
22352    } else if (this.featuresRtree_) {
22353      const s = (n) => {
22354        this.removeFeatureInternal(n);
22355      };
22356      this.featuresRtree_.forEach(s);
22357      for (const n in this.nullGeometryFeatures_)
22358        this.removeFeatureInternal(this.nullGeometryFeatures_[n]);
22359    }
22360    this.featuresCollection_ && this.featuresCollection_.clear(), this.featuresRtree_ && this.featuresRtree_.clear(), this.nullGeometryFeatures_ = {};
22361    const i = new Pi(le.CLEAR);
22362    this.dispatchEvent(i), this.changed();
22363  }
22364  /**
22365   * Iterate through all features on the source, calling the provided callback
22366   * with each one.  If the callback returns any "truthy" value, iteration will
22367   * stop and the function will return the same value.
22368   * Note: this function only iterate through the feature that have a defined geometry.
22369   *
22370   * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
22371   *     on the source.  Return a truthy value to stop iteration.
22372   * @return {T|undefined} The return value from the last call to the callback.
22373   * @template T
22374   * @api
22375   */
22376  forEachFeature(t) {
22377    if (this.featuresRtree_)
22378      return this.featuresRtree_.forEach(t);
22379    this.featuresCollection_ && this.featuresCollection_.forEach(t);
22380  }
22381  /**
22382   * Iterate through all features whose geometries contain the provided
22383   * coordinate, calling the callback with each feature.  If the callback returns
22384   * a "truthy" value, iteration will stop and the function will return the same
22385   * value.
22386   *
22387   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
22388   * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
22389   *     whose goemetry contains the provided coordinate.
22390   * @return {T|undefined} The return value from the last call to the callback.
22391   * @template T
22392   */
22393  forEachFeatureAtCoordinateDirect(t, i) {
22394    const s = [t[0], t[1], t[0], t[1]];
22395    return this.forEachFeatureInExtent(s, function(n) {
22396      if (n.getGeometry().intersectsCoordinate(t))
22397        return i(n);
22398    });
22399  }
22400  /**
22401   * Iterate through all features whose bounding box intersects the provided
22402   * extent (note that the feature's geometry may not intersect the extent),
22403   * calling the callback with each feature.  If the callback returns a "truthy"
22404   * value, iteration will stop and the function will return the same value.
22405   *
22406   * If you are interested in features whose geometry intersects an extent, call
22407   * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.
22408   *
22409   * When `useSpatialIndex` is set to false, this method will loop through all
22410   * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
22411   *
22412   * @param {import("../extent.js").Extent} extent Extent.
22413   * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
22414   *     whose bounding box intersects the provided extent.
22415   * @return {T|undefined} The return value from the last call to the callback.
22416   * @template T
22417   * @api
22418   */
22419  forEachFeatureInExtent(t, i) {
22420    if (this.featuresRtree_)
22421      return this.featuresRtree_.forEachInExtent(t, i);
22422    this.featuresCollection_ && this.featuresCollection_.forEach(i);
22423  }
22424  /**
22425   * Iterate through all features whose geometry intersects the provided extent,
22426   * calling the callback with each feature.  If the callback returns a "truthy"
22427   * value, iteration will stop and the function will return the same value.
22428   *
22429   * If you only want to test for bounding box intersection, call the
22430   * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
22431   *
22432   * @param {import("../extent.js").Extent} extent Extent.
22433   * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
22434   *     whose geometry intersects the provided extent.
22435   * @return {T|undefined} The return value from the last call to the callback.
22436   * @template T
22437   * @api
22438   */
22439  forEachFeatureIntersectingExtent(t, i) {
22440    return this.forEachFeatureInExtent(
22441      t,
22442      /**
22443       * @param {import("../Feature.js").default<Geometry>} feature Feature.
22444       * @return {T|undefined} The return value from the last call to the callback.
22445       */
22446      function(s) {
22447        if (s.getGeometry().intersectsExtent(t)) {
22448          const r = i(s);
22449          if (r)
22450            return r;
22451        }
22452      }
22453    );
22454  }
22455  /**
22456   * Get the features collection associated with this source. Will be `null`
22457   * unless the source was configured with `useSpatialIndex` set to `false`, or
22458   * with an {@link module:ol/Collection~Collection} as `features`.
22459   * @return {Collection<import("../Feature.js").default<Geometry>>|null} The collection of features.
22460   * @api
22461   */
22462  getFeaturesCollection() {
22463    return this.featuresCollection_;
22464  }
22465  /**
22466   * Get a snapshot of the features currently on the source in random order. The returned array
22467   * is a copy, the features are references to the features in the source.
22468   * @return {Array<import("../Feature.js").default<Geometry>>} Features.
22469   * @api
22470   */
22471  getFeatures() {
22472    let t;
22473    return this.featuresCollection_ ? t = this.featuresCollection_.getArray().slice(0) : this.featuresRtree_ && (t = this.featuresRtree_.getAll(), _n(this.nullGeometryFeatures_) || pi(t, Object.values(this.nullGeometryFeatures_))), /** @type {Array<import("../Feature.js").default<Geometry>>} */
22474    t;
22475  }
22476  /**
22477   * Get all features whose geometry intersects the provided coordinate.
22478   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
22479   * @return {Array<import("../Feature.js").default<Geometry>>} Features.
22480   * @api
22481   */
22482  getFeaturesAtCoordinate(t) {
22483    const i = [];
22484    return this.forEachFeatureAtCoordinateDirect(t, function(s) {
22485      i.push(s);
22486    }), i;
22487  }
22488  /**
22489   * Get all features whose bounding box intersects the provided extent.  Note that this returns an array of
22490   * all features intersecting the given extent in random order (so it may include
22491   * features whose geometries do not intersect the extent).
22492   *
22493   * When `useSpatialIndex` is set to false, this method will return all
22494   * features.
22495   *
22496   * @param {import("../extent.js").Extent} extent Extent.
22497   * @param {import("../proj/Projection.js").default} [projection] Include features
22498   * where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
22499   * @return {Array<import("../Feature.js").default<Geometry>>} Features.
22500   * @api
22501   */
22502  getFeaturesInExtent(t, i) {
22503    if (this.featuresRtree_) {
22504      if (!(i && i.canWrapX() && this.getWrapX()))
22505        return this.featuresRtree_.getInExtent(t);
22506      const n = s1(t, i);
22507      return [].concat(
22508        ...n.map((r) => this.featuresRtree_.getInExtent(r))
22509      );
22510    }
22511    return this.featuresCollection_ ? this.featuresCollection_.getArray().slice(0) : [];
22512  }
22513  /**
22514   * Get the closest feature to the provided coordinate.
22515   *
22516   * This method is not available when the source is configured with
22517   * `useSpatialIndex` set to `false`.
22518   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
22519   * @param {function(import("../Feature.js").default<Geometry>):boolean} [filter] Feature filter function.
22520   *     The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
22521   *     and it should return a boolean value. By default, no filtering is made.
22522   * @return {import("../Feature.js").default<Geometry>} Closest feature.
22523   * @api
22524   */
22525  getClosestFeatureToCoordinate(t, i) {
22526    const s = t[0], n = t[1];
22527    let r = null;
22528    const o = [NaN, NaN];
22529    let a = 1 / 0;
22530    const l = [-1 / 0, -1 / 0, 1 / 0, 1 / 0];
22531    return i = i || Ss, this.featuresRtree_.forEachInExtent(
22532      l,
22533      /**
22534       * @param {import("../Feature.js").default<Geometry>} feature Feature.
22535       */
22536      function(h) {
22537        if (i(h)) {
22538          const c = h.getGeometry(), u = a;
22539          if (a = c.closestPointXY(
22540            s,
22541            n,
22542            o,
22543            a
22544          ), a < u) {
22545            r = h;
22546            const d = Math.sqrt(a);
22547            l[0] = s - d, l[1] = n - d, l[2] = s + d, l[3] = n + d;
22548          }
22549        }
22550      }
22551    ), r;
22552  }
22553  /**
22554   * Get the extent of the features currently in the source.
22555   *
22556   * This method is not available when the source is configured with
22557   * `useSpatialIndex` set to `false`.
22558   * @param {import("../extent.js").Extent} [extent] Destination extent. If provided, no new extent
22559   *     will be created. Instead, that extent's coordinates will be overwritten.
22560   * @return {import("../extent.js").Extent} Extent.
22561   * @api
22562   */
22563  getExtent(t) {
22564    return this.featuresRtree_.getExtent(t);
22565  }
22566  /**
22567   * Get a feature by its identifier (the value returned by feature.getId()).
22568   * Note that the index treats string and numeric identifiers as the same.  So
22569   * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
22570   *
22571   * @param {string|number} id Feature identifier.
22572   * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
22573   * @api
22574   */
22575  getFeatureById(t) {
22576    const i = this.idIndex_[t.toString()];
22577    return i !== void 0 ? i : null;
22578  }
22579  /**
22580   * Get a feature by its internal unique identifier (using `getUid`).
22581   *
22582   * @param {string} uid Feature identifier.
22583   * @return {import("../Feature.js").default<Geometry>|null} The feature (or `null` if not found).
22584   */
22585  getFeatureByUid(t) {
22586    const i = this.uidIndex_[t];
22587    return i !== void 0 ? i : null;
22588  }
22589  /**
22590   * Get the format associated with this source.
22591   *
22592   * @return {import("../format/Feature.js").default|undefined} The feature format.
22593   * @api
22594   */
22595  getFormat() {
22596    return this.format_;
22597  }
22598  /**
22599   * @return {boolean} The source can have overlapping geometries.
22600   */
22601  getOverlaps() {
22602    return this.overlaps_;
22603  }
22604  /**
22605   * Get the url associated with this source.
22606   *
22607   * @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url.
22608   * @api
22609   */
22610  getUrl() {
22611    return this.url_;
22612  }
22613  /**
22614   * @param {Event} event Event.
22615   * @private
22616   */
22617  handleFeatureChange_(t) {
22618    const i = (
22619      /** @type {import("../Feature.js").default<Geometry>} */
22620      t.target
22621    ), s = ot(i), n = i.getGeometry();
22622    if (!n)
22623      s in this.nullGeometryFeatures_ || (this.featuresRtree_ && this.featuresRtree_.remove(i), this.nullGeometryFeatures_[s] = i);
22624    else {
22625      const o = n.getExtent();
22626      s in this.nullGeometryFeatures_ ? (delete this.nullGeometryFeatures_[s], this.featuresRtree_ && this.featuresRtree_.insert(o, i)) : this.featuresRtree_ && this.featuresRtree_.update(o, i);
22627    }
22628    const r = i.getId();
22629    if (r !== void 0) {
22630      const o = r.toString();
22631      this.idIndex_[o] !== i && (this.removeFromIdIndex_(i), this.idIndex_[o] = i);
22632    } else
22633      this.removeFromIdIndex_(i), this.uidIndex_[s] = i;
22634    this.changed(), this.dispatchEvent(
22635      new Pi(le.CHANGEFEATURE, i)
22636    );
22637  }
22638  /**
22639   * Returns true if the feature is contained within the source.
22640   * @param {import("../Feature.js").default<Geometry>} feature Feature.
22641   * @return {boolean} Has feature.
22642   * @api
22643   */
22644  hasFeature(t) {
22645    const i = t.getId();
22646    return i !== void 0 ? i in this.idIndex_ : ot(t) in this.uidIndex_;
22647  }
22648  /**
22649   * @return {boolean} Is empty.
22650   */
22651  isEmpty() {
22652    return this.featuresRtree_ ? this.featuresRtree_.isEmpty() && _n(this.nullGeometryFeatures_) : this.featuresCollection_ ? this.featuresCollection_.getLength() === 0 : !0;
22653  }
22654  /**
22655   * @param {import("../extent.js").Extent} extent Extent.
22656   * @param {number} resolution Resolution.
22657   * @param {import("../proj/Projection.js").default} projection Projection.
22658   */
22659  loadFeatures(t, i, s) {
22660    const n = this.loadedExtentsRtree_, r = this.strategy_(t, i, s);
22661    for (let o = 0, a = r.length; o < a; ++o) {
22662      const l = r[o];
22663      n.forEachInExtent(
22664        l,
22665        /**
22666         * @param {{extent: import("../extent.js").Extent}} object Object.
22667         * @return {boolean} Contains.
22668         */
22669        function(c) {
22670          return Gi(c.extent, l);
22671        }
22672      ) || (++this.loadingExtentsCount_, this.dispatchEvent(
22673        new Pi(le.FEATURESLOADSTART)
22674      ), this.loader_.call(
22675        this,
22676        l,
22677        i,
22678        s,
22679        (c) => {
22680          --this.loadingExtentsCount_, this.dispatchEvent(
22681            new Pi(
22682              le.FEATURESLOADEND,
22683              void 0,
22684              c
22685            )
22686          );
22687        },
22688        () => {
22689          --this.loadingExtentsCount_, this.dispatchEvent(
22690            new Pi(le.FEATURESLOADERROR)
22691          );
22692        }
22693      ), n.insert(l, { extent: l.slice() }));
22694    }
22695    this.loading = this.loader_.length < 4 ? !1 : this.loadingExtentsCount_ > 0;
22696  }
22697  refresh() {
22698    this.clear(!0), this.loadedExtentsRtree_.clear(), super.refresh();
22699  }
22700  /**
22701   * Remove an extent from the list of loaded extents.
22702   * @param {import("../extent.js").Extent} extent Extent.
22703   * @api
22704   */
22705  removeLoadedExtent(t) {
22706    const i = this.loadedExtentsRtree_;
22707    let s;
22708    i.forEachInExtent(t, function(n) {
22709      if (pn(n.extent, t))
22710        return s = n, !0;
22711    }), s && i.remove(s);
22712  }
22713  /**
22714   * Remove a single feature from the source.  If you want to remove all features
22715   * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
22716   * instead.
22717   * @param {import("../Feature.js").default<Geometry>} feature Feature to remove.
22718   * @api
22719   */
22720  removeFeature(t) {
22721    if (!t)
22722      return;
22723    const i = ot(t);
22724    i in this.nullGeometryFeatures_ ? delete this.nullGeometryFeatures_[i] : this.featuresRtree_ && this.featuresRtree_.remove(t), this.removeFeatureInternal(t) && this.changed();
22725  }
22726  /**
22727   * Remove feature without firing a `change` event.
22728   * @param {import("../Feature.js").default<Geometry>} feature Feature.
22729   * @return {import("../Feature.js").default<Geometry>|undefined} The removed feature
22730   *     (or undefined if the feature was not found).
22731   * @protected
22732   */
22733  removeFeatureInternal(t) {
22734    const i = ot(t), s = this.featureChangeKeys_[i];
22735    if (!s)
22736      return;
22737    s.forEach(Mt), delete this.featureChangeKeys_[i];
22738    const n = t.getId();
22739    return n !== void 0 && delete this.idIndex_[n.toString()], delete this.uidIndex_[i], this.dispatchEvent(
22740      new Pi(le.REMOVEFEATURE, t)
22741    ), t;
22742  }
22743  /**
22744   * Remove a feature from the id index.  Called internally when the feature id
22745   * may have changed.
22746   * @param {import("../Feature.js").default<Geometry>} feature The feature.
22747   * @return {boolean} Removed the feature from the index.
22748   * @private
22749   */
22750  removeFromIdIndex_(t) {
22751    let i = !1;
22752    for (const s in this.idIndex_)
22753      if (this.idIndex_[s] === t) {
22754        delete this.idIndex_[s], i = !0;
22755        break;
22756      }
22757    return i;
22758  }
22759  /**
22760   * Set the new loader of the source. The next render cycle will use the
22761   * new loader.
22762   * @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
22763   * @api
22764   */
22765  setLoader(t) {
22766    this.loader_ = t;
22767  }
22768  /**
22769   * Points the source to a new url. The next render cycle will use the new url.
22770   * @param {string|import("../featureloader.js").FeatureUrlFunction} url Url.
22771   * @api
22772   */
22773  setUrl(t) {
22774    at(this.format_, 7), this.url_ = t, this.setLoader(Hu(t, this.format_));
22775  }
22776}
22777const va = Db;
22778class Nb extends Ar {
22779  /**
22780   * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
22781   * @param {import("./TileState.js").default} state State.
22782   * @param {Options} [options] Tile options.
22783   */
22784  constructor(t, i, s) {
22785    super(), s = s || {}, this.tileCoord = t, this.state = i, this.interimTile = null, this.key = "", this.transition_ = s.transition === void 0 ? 250 : s.transition, this.transitionStarts_ = {}, this.interpolate = !!s.interpolate;
22786  }
22787  /**
22788   * @protected
22789   */
22790  changed() {
22791    this.dispatchEvent(et.CHANGE);
22792  }
22793  /**
22794   * Called by the tile cache when the tile is removed from the cache due to expiry
22795   */
22796  release() {
22797    this.state === H.ERROR && this.setState(H.EMPTY);
22798  }
22799  /**
22800   * @return {string} Key.
22801   */
22802  getKey() {
22803    return this.key + "/" + this.tileCoord;
22804  }
22805  /**
22806   * Get the interim tile most suitable for rendering using the chain of interim
22807   * tiles. This corresponds to the  most recent tile that has been loaded, if no
22808   * such tile exists, the original tile is returned.
22809   * @return {!Tile} Best tile for rendering.
22810   */
22811  getInterimTile() {
22812    if (!this.interimTile)
22813      return this;
22814    let t = this.interimTile;
22815    do {
22816      if (t.getState() == H.LOADED)
22817        return this.transition_ = 0, t;
22818      t = t.interimTile;
22819    } while (t);
22820    return this;
22821  }
22822  /**
22823   * Goes through the chain of interim tiles and discards sections of the chain
22824   * that are no longer relevant.
22825   */
22826  refreshInterimChain() {
22827    if (!this.interimTile)
22828      return;
22829    let t = this.interimTile, i = this;
22830    do {
22831      if (t.getState() == H.LOADED) {
22832        t.interimTile = null;
22833        break;
22834      } else
22835        t.getState() == H.LOADING ? i = t : t.getState() == H.IDLE ? i.interimTile = t.interimTile : i = t;
22836      t = i.interimTile;
22837    } while (t);
22838  }
22839  /**
22840   * Get the tile coordinate for this tile.
22841   * @return {import("./tilecoord.js").TileCoord} The tile coordinate.
22842   * @api
22843   */
22844  getTileCoord() {
22845    return this.tileCoord;
22846  }
22847  /**
22848   * @return {import("./TileState.js").default} State.
22849   */
22850  getState() {
22851    return this.state;
22852  }
22853  /**
22854   * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,
22855   * it is important to set the state correctly to {@link module:ol/TileState~ERROR}
22856   * when the tile cannot be loaded. Otherwise the tile cannot be removed from
22857   * the tile queue and will block other requests.
22858   * @param {import("./TileState.js").default} state State.
22859   * @api
22860   */
22861  setState(t) {
22862    if (this.state !== H.ERROR && this.state > t)
22863      throw new Error("Tile load sequence violation");
22864    this.state = t, this.changed();
22865  }
22866  /**
22867   * Load the image or retry if loading previously failed.
22868   * Loading is taken care of by the tile queue, and calling this method is
22869   * only needed for preloading or for reloading in case of an error.
22870   * @abstract
22871   * @api
22872   */
22873  load() {
22874    Z();
22875  }
22876  /**
22877   * Get the alpha value for rendering.
22878   * @param {string} id An id for the renderer.
22879   * @param {number} time The render frame time.
22880   * @return {number} A number between 0 and 1.
22881   */
22882  getAlpha(t, i) {
22883    if (!this.transition_)
22884      return 1;
22885    let s = this.transitionStarts_[t];
22886    if (!s)
22887      s = i, this.transitionStarts_[t] = s;
22888    else if (s === -1)
22889      return 1;
22890    const n = i - s + 1e3 / 60;
22891    return n >= this.transition_ ? 1 : Qf(n / this.transition_);
22892  }
22893  /**
22894   * Determine if a tile is in an alpha transition.  A tile is considered in
22895   * transition if tile.getAlpha() has not yet been called or has been called
22896   * and returned 1.
22897   * @param {string} id An id for the renderer.
22898   * @return {boolean} The tile is in transition.
22899   */
22900  inTransition(t) {
22901    return this.transition_ ? this.transitionStarts_[t] !== -1 : !1;
22902  }
22903  /**
22904   * Mark a transition as complete.
22905   * @param {string} id An id for the renderer.
22906   */
22907  endTransition(t) {
22908    this.transition_ && (this.transitionStarts_[t] = -1);
22909  }
22910}
22911const Dg = Nb;
22912class Gb extends Dg {
22913  /**
22914   * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
22915   * @param {import("./TileState.js").default} state State.
22916   * @param {string} src Image source URI.
22917   * @param {?string} crossOrigin Cross origin.
22918   * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
22919   * @param {import("./Tile.js").Options} [options] Tile options.
22920   */
22921  constructor(t, i, s, n, r, o) {
22922    super(t, i, o), this.crossOrigin_ = n, this.src_ = s, this.key = s, this.image_ = new Image(), n !== null && (this.image_.crossOrigin = n), this.unlisten_ = null, this.tileLoadFunction_ = r;
22923  }
22924  /**
22925   * Get the HTML image element for this tile (may be a Canvas, Image, or Video).
22926   * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
22927   * @api
22928   */
22929  getImage() {
22930    return this.image_;
22931  }
22932  /**
22933   * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).
22934   * @param {HTMLCanvasElement|HTMLImageElement} element Element.
22935   */
22936  setImage(t) {
22937    this.image_ = t, this.state = H.LOADED, this.unlistenImage_(), this.changed();
22938  }
22939  /**
22940   * Tracks loading or read errors.
22941   *
22942   * @private
22943   */
22944  handleImageError_() {
22945    this.state = H.ERROR, this.unlistenImage_(), this.image_ = zb(), this.changed();
22946  }
22947  /**
22948   * Tracks successful image load.
22949   *
22950   * @private
22951   */
22952  handleImageLoad_() {
22953    const t = (
22954      /** @type {HTMLImageElement} */
22955      this.image_
22956    );
22957    t.naturalWidth && t.naturalHeight ? this.state = H.LOADED : this.state = H.EMPTY, this.unlistenImage_(), this.changed();
22958  }
22959  /**
22960   * Load the image or retry if loading previously failed.
22961   * Loading is taken care of by the tile queue, and calling this method is
22962   * only needed for preloading or for reloading in case of an error.
22963   *
22964   * To retry loading tiles on failed requests, use a custom `tileLoadFunction`
22965   * that checks for error status codes and reloads only when the status code is
22966   * 408, 429, 500, 502, 503 and 504, and only when not too many retries have been
22967   * made already:
22968   *
22969   * ```js
22970   * const retryCodes = [408, 429, 500, 502, 503, 504];
22971   * const retries = {};
22972   * source.setTileLoadFunction((tile, src) => {
22973   *   const image = tile.getImage();
22974   *   fetch(src)
22975   *     .then((response) => {
22976   *       if (retryCodes.includes(response.status)) {
22977   *         retries[src] = (retries[src] || 0) + 1;
22978   *         if (retries[src] <= 3) {
22979   *           setTimeout(() => tile.load(), retries[src] * 1000);
22980   *         }
22981   *         return Promise.reject();
22982   *       }
22983   *       return response.blob();
22984   *     })
22985   *     .then((blob) => {
22986   *       const imageUrl = URL.createObjectURL(blob);
22987   *       image.src = imageUrl;
22988   *       setTimeout(() => URL.revokeObjectURL(imageUrl), 5000);
22989   *     })
22990   *     .catch(() => tile.setState(3)); // error
22991   * });
22992   * ```
22993   *
22994   * @api
22995   */
22996  load() {
22997    this.state == H.ERROR && (this.state = H.IDLE, this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_)), this.state == H.IDLE && (this.state = H.LOADING, this.changed(), this.tileLoadFunction_(this, this.src_), this.unlisten_ = Qh(
22998      this.image_,
22999      this.handleImageLoad_.bind(this),
23000      this.handleImageError_.bind(this)
23001    ));
23002  }
23003  /**
23004   * Discards event handlers which listen for load completion or errors.
23005   *
23006   * @private
23007   */
23008  unlistenImage_() {
23009    this.unlisten_ && (this.unlisten_(), this.unlisten_ = null);
23010  }
23011}
23012function zb() {
23013  const e = re(1, 1);
23014  return e.fillStyle = "rgba(0,0,0,0)", e.fillRect(0, 0, 1, 1), e.canvas;
23015}
23016const Ng = Gb;
23017class jb {
23018  /**
23019   * @param {number} [highWaterMark] High water mark.
23020   */
23021  constructor(t) {
23022    this.highWaterMark = t !== void 0 ? t : 2048, this.count_ = 0, this.entries_ = {}, this.oldest_ = null, this.newest_ = null;
23023  }
23024  /**
23025   * @return {boolean} Can expire cache.
23026   */
23027  canExpireCache() {
23028    return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;
23029  }
23030  /**
23031   * Expire the cache.
23032   * @param {!Object<string, boolean>} [keep] Keys to keep. To be implemented by subclasses.
23033   */
23034  expireCache(t) {
23035    for (; this.canExpireCache(); )
23036      this.pop();
23037  }
23038  /**
23039   * FIXME empty description for jsdoc
23040   */
23041  clear() {
23042    this.count_ = 0, this.entries_ = {}, this.oldest_ = null, this.newest_ = null;
23043  }
23044  /**
23045   * @param {string} key Key.
23046   * @return {boolean} Contains key.
23047   */
23048  containsKey(t) {
23049    return this.entries_.hasOwnProperty(t);
23050  }
23051  /**
23052   * @param {function(T, string, LRUCache<T>): ?} f The function
23053   *     to call for every entry from the oldest to the newer. This function takes
23054   *     3 arguments (the entry value, the entry key and the LRUCache object).
23055   *     The return value is ignored.
23056   */
23057  forEach(t) {
23058    let i = this.oldest_;
23059    for (; i; )
23060      t(i.value_, i.key_, this), i = i.newer;
23061  }
23062  /**
23063   * @param {string} key Key.
23064   * @param {*} [options] Options (reserved for subclasses).
23065   * @return {T} Value.
23066   */
23067  get(t, i) {
23068    const s = this.entries_[t];
23069    return at(s !== void 0, 15), s === this.newest_ || (s === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
23070    this.oldest_.newer, this.oldest_.older = null) : (s.newer.older = s.older, s.older.newer = s.newer), s.newer = null, s.older = this.newest_, this.newest_.newer = s, this.newest_ = s), s.value_;
23071  }
23072  /**
23073   * Remove an entry from the cache.
23074   * @param {string} key The entry key.
23075   * @return {T} The removed entry.
23076   */
23077  remove(t) {
23078    const i = this.entries_[t];
23079    return at(i !== void 0, 15), i === this.newest_ ? (this.newest_ = /** @type {Entry} */
23080    i.older, this.newest_ && (this.newest_.newer = null)) : i === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
23081    i.newer, this.oldest_ && (this.oldest_.older = null)) : (i.newer.older = i.older, i.older.newer = i.newer), delete this.entries_[t], --this.count_, i.value_;
23082  }
23083  /**
23084   * @return {number} Count.
23085   */
23086  getCount() {
23087    return this.count_;
23088  }
23089  /**
23090   * @return {Array<string>} Keys.
23091   */
23092  getKeys() {
23093    const t = new Array(this.count_);
23094    let i = 0, s;
23095    for (s = this.newest_; s; s = s.older)
23096      t[i++] = s.key_;
23097    return t;
23098  }
23099  /**
23100   * @return {Array<T>} Values.
23101   */
23102  getValues() {
23103    const t = new Array(this.count_);
23104    let i = 0, s;
23105    for (s = this.newest_; s; s = s.older)
23106      t[i++] = s.value_;
23107    return t;
23108  }
23109  /**
23110   * @return {T} Last value.
23111   */
23112  peekLast() {
23113    return this.oldest_.value_;
23114  }
23115  /**
23116   * @return {string} Last key.
23117   */
23118  peekLastKey() {
23119    return this.oldest_.key_;
23120  }
23121  /**
23122   * Get the key of the newest item in the cache.  Throws if the cache is empty.
23123   * @return {string} The newest key.
23124   */
23125  peekFirstKey() {
23126    return this.newest_.key_;
23127  }
23128  /**
23129   * Return an entry without updating least recently used time.
23130   * @param {string} key Key.
23131   * @return {T} Value.
23132   */
23133  peek(t) {
23134    if (this.containsKey(t))
23135      return this.entries_[t].value_;
23136  }
23137  /**
23138   * @return {T} value Value.
23139   */
23140  pop() {
23141    const t = this.oldest_;
23142    return delete this.entries_[t.key_], t.newer && (t.newer.older = null), this.oldest_ = /** @type {Entry} */
23143    t.newer, this.oldest_ || (this.newest_ = null), --this.count_, t.value_;
23144  }
23145  /**
23146   * @param {string} key Key.
23147   * @param {T} value Value.
23148   */
23149  replace(t, i) {
23150    this.get(t), this.entries_[t].value_ = i;
23151  }
23152  /**
23153   * @param {string} key Key.
23154   * @param {T} value Value.
23155   */
23156  set(t, i) {
23157    at(!(t in this.entries_), 16);
23158    const s = {
23159      key_: t,
23160      newer: null,
23161      older: this.newest_,
23162      value_: i
23163    };
23164    this.newest_ ? this.newest_.newer = s : this.oldest_ = s, this.newest_ = s, this.entries_[t] = s, ++this.count_;
23165  }
23166  /**
23167   * Set a maximum number of entries for the cache.
23168   * @param {number} size Cache size.
23169   * @api
23170   */
23171  setSize(t) {
23172    this.highWaterMark = t;
23173  }
23174}
23175const Wb = jb;
23176function Zu(e, t, i, s) {
23177  return s !== void 0 ? (s[0] = e, s[1] = t, s[2] = i, s) : [e, t, i];
23178}
23179function Ea(e, t, i) {
23180  return e + "/" + t + "/" + i;
23181}
23182function Gg(e) {
23183  return Ea(e[0], e[1], e[2]);
23184}
23185function Bb(e) {
23186  return e.split("/").map(Number);
23187}
23188function zg(e) {
23189  return (e[1] << e[0]) + e[2];
23190}
23191function Ub(e, t) {
23192  const i = e[0], s = e[1], n = e[2];
23193  if (t.getMinZoom() > i || i > t.getMaxZoom())
23194    return !1;
23195  const r = t.getFullTileRange(i);
23196  return r ? r.containsXY(s, n) : !0;
23197}
23198class Xb extends Wb {
23199  clear() {
23200    for (; this.getCount() > 0; )
23201      this.pop().release();
23202    super.clear();
23203  }
23204  /**
23205   * @param {!Object<string, boolean>} usedTiles Used tiles.
23206   */
23207  expireCache(t) {
23208    for (; this.canExpireCache() && !(this.peekLast().getKey() in t); )
23209      this.pop().release();
23210  }
23211  /**
23212   * Prune all tiles from the cache that don't have the same z as the newest tile.
23213   */
23214  pruneExceptNewestZ() {
23215    if (this.getCount() === 0)
23216      return;
23217    const t = this.peekFirstKey(), s = Bb(t)[0];
23218    this.forEach((n) => {
23219      n.tileCoord[0] !== s && (this.remove(Gg(n.tileCoord)), n.release());
23220    });
23221  }
23222}
23223const jg = Xb;
23224class Wg {
23225  /**
23226   * @param {number} minX Minimum X.
23227   * @param {number} maxX Maximum X.
23228   * @param {number} minY Minimum Y.
23229   * @param {number} maxY Maximum Y.
23230   */
23231  constructor(t, i, s, n) {
23232    this.minX = t, this.maxX = i, this.minY = s, this.maxY = n;
23233  }
23234  /**
23235   * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
23236   * @return {boolean} Contains tile coordinate.
23237   */
23238  contains(t) {
23239    return this.containsXY(t[1], t[2]);
23240  }
23241  /**
23242   * @param {TileRange} tileRange Tile range.
23243   * @return {boolean} Contains.
23244   */
23245  containsTileRange(t) {
23246    return this.minX <= t.minX && t.maxX <= this.maxX && this.minY <= t.minY && t.maxY <= this.maxY;
23247  }
23248  /**
23249   * @param {number} x Tile coordinate x.
23250   * @param {number} y Tile coordinate y.
23251   * @return {boolean} Contains coordinate.
23252   */
23253  containsXY(t, i) {
23254    return this.minX <= t && t <= this.maxX && this.minY <= i && i <= this.maxY;
23255  }
23256  /**
23257   * @param {TileRange} tileRange Tile range.
23258   * @return {boolean} Equals.
23259   */
23260  equals(t) {
23261    return this.minX == t.minX && this.minY == t.minY && this.maxX == t.maxX && this.maxY == t.maxY;
23262  }
23263  /**
23264   * @param {TileRange} tileRange Tile range.
23265   */
23266  extend(t) {
23267    t.minX < this.minX && (this.minX = t.minX), t.maxX > this.maxX && (this.maxX = t.maxX), t.minY < this.minY && (this.minY = t.minY), t.maxY > this.maxY && (this.maxY = t.maxY);
23268  }
23269  /**
23270   * @return {number} Height.
23271   */
23272  getHeight() {
23273    return this.maxY - this.minY + 1;
23274  }
23275  /**
23276   * @return {import("./size.js").Size} Size.
23277   */
23278  getSize() {
23279    return [this.getWidth(), this.getHeight()];
23280  }
23281  /**
23282   * @return {number} Width.
23283   */
23284  getWidth() {
23285    return this.maxX - this.minX + 1;
23286  }
23287  /**
23288   * @param {TileRange} tileRange Tile range.
23289   * @return {boolean} Intersects.
23290   */
23291  intersects(t) {
23292    return this.minX <= t.maxX && this.maxX >= t.minX && this.minY <= t.maxY && this.maxY >= t.minY;
23293  }
23294}
23295function js(e, t, i, s, n) {
23296  return n !== void 0 ? (n.minX = e, n.maxX = t, n.minY = i, n.maxY = s, n) : new Wg(e, t, i, s);
23297}
23298const Bg = Wg, Ju = 0, Qn = 1, Qu = [0, 0, 0, 0], un = [], Ya = {
23299  /**
23300   * Triggered upon feature modification start
23301   * @event ModifyEvent#modifystart
23302   * @api
23303   */
23304  MODIFYSTART: "modifystart",
23305  /**
23306   * Triggered upon feature modification end
23307   * @event ModifyEvent#modifyend
23308   * @api
23309   */
23310  MODIFYEND: "modifyend"
23311};
23312class Ka extends Ae {
23313  /**
23314   * @param {ModifyEventType} type Type.
23315   * @param {Collection<Feature>} features
23316   * The features modified.
23317   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent
23318   * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
23319   */
23320  constructor(t, i, s) {
23321    super(t), this.features = i, this.mapBrowserEvent = s;
23322  }
23323}
23324class $b extends is {
23325  /**
23326   * @param {Options} options Options.
23327   */
23328  constructor(t) {
23329    super(
23330      /** @type {import("./Pointer.js").Options} */
23331      t
23332    ), this.on, this.once, this.un, this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this), this.condition_ = t.condition ? t.condition : vg, this.defaultDeleteCondition_ = function(s) {
23333      return XM(s) && qM(s);
23334    }, this.deleteCondition_ = t.deleteCondition ? t.deleteCondition : this.defaultDeleteCondition_, this.insertVertexCondition_ = t.insertVertexCondition ? t.insertVertexCondition : jo, this.vertexFeature_ = null, this.vertexSegments_ = null, this.lastPixel_ = [0, 0], this.ignoreNextSingleClick_ = !1, this.featuresBeingModified_ = null, this.rBush_ = new Bo(), this.pixelTolerance_ = t.pixelTolerance !== void 0 ? t.pixelTolerance : 10, this.snappedToVertex_ = !1, this.changingFeature_ = !1, this.dragSegments_ = [], this.overlay_ = new xa({
23335      source: new va({
23336        useSpatialIndex: !1,
23337        wrapX: !!t.wrapX
23338      }),
23339      style: t.style ? t.style : Kb(),
23340      updateWhileAnimating: !0,
23341      updateWhileInteracting: !0
23342    }), this.SEGMENT_WRITERS_ = {
23343      Point: this.writePointGeometry_.bind(this),
23344      LineString: this.writeLineStringGeometry_.bind(this),
23345      LinearRing: this.writeLineStringGeometry_.bind(this),
23346      Polygon: this.writePolygonGeometry_.bind(this),
23347      MultiPoint: this.writeMultiPointGeometry_.bind(this),
23348      MultiLineString: this.writeMultiLineStringGeometry_.bind(this),
23349      MultiPolygon: this.writeMultiPolygonGeometry_.bind(this),
23350      Circle: this.writeCircleGeometry_.bind(this),
23351      GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this)
23352    }, this.source_ = null, this.hitDetection_ = null;
23353    let i;
23354    if (t.features ? i = t.features : t.source && (this.source_ = t.s
23354ource, i = new Pe(this.source_.getFeatures()), this.source_.addEventListener(
23355      le.ADDFEATURE,
23356      this.handleSourceAdd_.bind(this)
23357    ), this.source_.addEventListener(
23358      le.REMOVEFEATURE,
23359      this.handleSourceRemove_.bind(this)
23360    )), !i)
23361      throw new Error(
23362        "The modify interaction requires features, a source or a layer"
23363      );
23364    t.hitDetection && (this.hitDetection_ = t.hitDetection), this.features_ = i, this.features_.forEach(this.addFeature_.bind(this)), this.features_.addEventListener(
23365      $t.ADD,
23366      this.handleFeatureAdd_.bind(this)
23367    ), this.features_.addEventListener(
23368      $t.REMOVE,
23369      this.handleFeatureRemove_.bind(this)
23370    ), this.lastPointerEvent_ = null, this.delta_ = [0, 0], this.snapToPointer_ = t.snapToPointer === void 0 ? !this.hitDetection_ : t.snapToPointer;
23371  }
23372  /**
23373   * @param {Feature} feature Feature.
23374   * @private
23375   */
23376  addFeature_(t) {
23377    const i = t.getGeometry();
23378    if (i) {
23379      const n = this.SEGMENT_WRITERS_[i.getType()];
23380      n && n(t, i);
23381    }
23382    const s = this.getMap();
23383    s && s.isRendered() && this.getActive() && this.handlePointerAtPixel_(this.lastPixel_, s), t.addEventListener(et.CHANGE, this.boundHandleFeatureChange_);
23384  }
23385  /**
23386   * @param {import("../MapBrowserEvent.js").default} evt Map browser event.
23387   * @param {Array<Array<SegmentData>>} segments The segments subject to modification.
23388   * @private
23389   */
23390  willModifyFeatures_(t, i) {
23391    if (!this.featuresBeingModified_) {
23392      this.featuresBeingModified_ = new Pe();
23393      const s = this.featuresBeingModified_.getArray();
23394      for (let n = 0, r = i.length; n < r; ++n) {
23395        const o = i[n];
23396        for (let a = 0, l = o.length; a < l; ++a) {
23397          const h = o[a].feature;
23398          h && !s.includes(h) && this.featuresBeingModified_.push(h);
23399        }
23400      }
23401      this.featuresBeingModified_.getLength() === 0 ? this.featuresBeingModified_ = null : this.dispatchEvent(
23402        new Ka(
23403          Ya.MODIFYSTART,
23404          this.featuresBeingModified_,
23405          t
23406        )
23407      );
23408    }
23409  }
23410  /**
23411   * @param {Feature} feature Feature.
23412   * @private
23413   */
23414  removeFeature_(t) {
23415    this.removeFeatureSegmentData_(t), this.vertexFeature_ && this.features_.getLength() === 0 && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null), t.removeEventListener(
23416      et.CHANGE,
23417      this.boundHandleFeatureChange_
23418    );
23419  }
23420  /**
23421   * @param {Feature} feature Feature.
23422   * @private
23423   */
23424  removeFeatureSegmentData_(t) {
23425    const i = this.rBush_, s = [];
23426    i.forEach(
23427      /**
23428       * @param {SegmentData} node RTree node.
23429       */
23430      function(n) {
23431        t === n.feature && s.push(n);
23432      }
23433    );
23434    for (let n = s.length - 1; n >= 0; --n) {
23435      const r = s[n];
23436      for (let o = this.dragSegments_.length - 1; o >= 0; --o)
23437        this.dragSegments_[o][0] === r && this.dragSegments_.splice(o, 1);
23438      i.remove(r);
23439    }
23440  }
23441  /**
23442   * Activate or deactivate the interaction.
23443   * @param {boolean} active Active.
23444   * @observable
23445   * @api
23446   */
23447  setActive(t) {
23448    this.vertexFeature_ && !t && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null), super.setActive(t);
23449  }
23450  /**
23451   * Remove the interaction from its current map and attach it to the new map.
23452   * Subclasses may set up event handlers to get notified about changes to
23453   * the map here.
23454   * @param {import("../Map.js").default} map Map.
23455   */
23456  setMap(t) {
23457    this.overlay_.setMap(t), super.setMap(t);
23458  }
23459  /**
23460   * Get the overlay layer that this interaction renders the modification point or vertex to.
23461   * @return {VectorLayer} Overlay layer.
23462   * @api
23463   */
23464  getOverlay() {
23465    return this.overlay_;
23466  }
23467  /**
23468   * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
23469   * @private
23470   */
23471  handleSourceAdd_(t) {
23472    t.feature && this.features_.push(t.feature);
23473  }
23474  /**
23475   * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
23476   * @private
23477   */
23478  handleSourceRemove_(t) {
23479    t.feature && this.features_.remove(t.feature);
23480  }
23481  /**
23482   * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
23483   * @private
23484   */
23485  handleFeatureAdd_(t) {
23486    this.addFeature_(t.element);
23487  }
23488  /**
23489   * @param {import("../events/Event.js").default} evt Event.
23490   * @private
23491   */
23492  handleFeatureChange_(t) {
23493    if (!this.changingFeature_) {
23494      const i = (
23495        /** @type {Feature} */
23496        t.target
23497      );
23498      this.removeFeature_(i), this.addFeature_(i);
23499    }
23500  }
23501  /**
23502   * @param {import("../Collection.js").CollectionEvent<Feature>} evt Event.
23503   * @private
23504   */
23505  handleFeatureRemove_(t) {
23506    this.removeFeature_(t.element);
23507  }
23508  /**
23509   * @param {Feature} feature Feature
23510   * @param {Point} geometry Geometry.
23511   * @private
23512   */
23513  writePointGeometry_(t, i) {
23514    const s = i.getCoordinates(), n = {
23515      feature: t,
23516      geometry: i,
23517      segment: [s, s]
23518    };
23519    this.rBush_.insert(i.getExtent(), n);
23520  }
23521  /**
23522   * @param {Feature} feature Feature
23523   * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
23524   * @private
23525   */
23526  writeMultiPointGeometry_(t, i) {
23527    const s = i.getCoordinates();
23528    for (let n = 0, r = s.length; n < r; ++n) {
23529      const o = s[n], a = {
23530        feature: t,
23531        geometry: i,
23532        depth: [n],
23533        index: n,
23534        segment: [o, o]
23535      };
23536      this.rBush_.insert(i.getExtent(), a);
23537    }
23538  }
23539  /**
23540   * @param {Feature} feature Feature
23541   * @param {import("../geom/LineString.js").default} geometry Geometry.
23542   * @private
23543   */
23544  writeLineStringGeometry_(t, i) {
23545    const s = i.getCoordinates();
23546    for (let n = 0, r = s.length - 1; n < r; ++n) {
23547      const o = s.slice(n, n + 2), a = {
23548        feature: t,
23549        geometry: i,
23550        index: n,
23551        segment: o
23552      };
23553      this.rBush_.insert(ce(o), a);
23554    }
23555  }
23556  /**
23557   * @param {Feature} feature Feature
23558   * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
23559   * @private
23560   */
23561  writeMultiLineStringGeometry_(t, i) {
23562    const s = i.getCoordinates();
23563    for (let n = 0, r = s.length; n < r; ++n) {
23564      const o = s[n];
23565      for (let a = 0, l = o.length - 1; a < l; ++a) {
23566        const h = o.slice(a, a + 2), c = {
23567          feature: t,
23568          geometry: i,
23569          depth: [n],
23570          index: a,
23571          segment: h
23572        };
23573        this.rBush_.insert(ce(h), c);
23574      }
23575    }
23576  }
23577  /**
23578   * @param {Feature} feature Feature
23579   * @param {import("../geom/Polygon.js").default} geometry Geometry.
23580   * @private
23581   */
23582  writePolygonGeometry_(t, i) {
23583    const s = i.getCoordinates();
23584    for (let n = 0, r = s.length; n < r; ++n) {
23585      const o = s[n];
23586      for (let a = 0, l = o.length - 1; a < l; ++a) {
23587        const h = o.slice(a, a + 2), c = {
23588          feature: t,
23589          geometry: i,
23590          depth: [n],
23591          index: a,
23592          segment: h
23593        };
23594        this.rBush_.insert(ce(h), c);
23595      }
23596    }
23597  }
23598  /**
23599   * @param {Feature} feature Feature
23600   * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
23601   * @private
23602   */
23603  writeMultiPolygonGeometry_(t, i) {
23604    const s = i.getCoordinates();
23605    for (let n = 0, r = s.length; n < r; ++n) {
23606      const o = s[n];
23607      for (let a = 0, l = o.length; a < l; ++a) {
23608        const h = o[a];
23609        for (let c = 0, u = h.length - 1; c < u; ++c) {
23610          const d = h.slice(c, c + 2), f = {
23611            feature: t,
23612            geometry: i,
23613            depth: [a, n],
23614            index: c,
23615            segment: d
23616          };
23617          this.rBush_.insert(ce(d), f);
23618        }
23619      }
23620    }
23621  }
23622  /**
23623   * We convert a circle into two segments.  The segment at index
23624   * {@link CIRCLE_CENTER_INDEX} is the
23625   * circle's center (a point).  The segment at index
23626   * {@link CIRCLE_CIRCUMFERENCE_INDEX} is
23627   * the circumference, and is not a line segment.
23628   *
23629   * @param {Feature} feature Feature.
23630   * @param {import("../geom/Circle.js").default} geometry Geometry.
23631   * @private
23632   */
23633  writeCircleGeometry_(t, i) {
23634    const s = i.getCenter(), n = {
23635      feature: t,
23636      geometry: i,
23637      index: Ju,
23638      segment: [s, s]
23639    }, r = {
23640      feature: t,
23641      geometry: i,
23642      index: Qn,
23643      segment: [s, s]
23644    }, o = [n, r];
23645    n.featureSegments = o, r.featureSegments = o, this.rBush_.insert(go(s), n);
23646    let a = (
23647      /** @type {import("../geom/Geometry.js").default} */
23648      i
23649    );
23650    this.rBush_.insert(a.getExtent(), r);
23651  }
23652  /**
23653   * @param {Feature} feature Feature
23654   * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
23655   * @private
23656   */
23657  writeGeometryCollectionGeometry_(t, i) {
23658    const s = i.getGeometriesArray();
23659    for (let n = 0; n < s.length; ++n) {
23660      const r = s[n], o = this.SEGMENT_WRITERS_[r.getType()];
23661      o(t, r);
23662    }
23663  }
23664  /**
23665   * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
23666   * @param {Array<Feature>} features The features being modified.
23667   * @param {Array<import("../geom/SimpleGeometry.js").default>} geometries The geometries being modified.
23668   * @return {Feature} Vertex feature.
23669   * @private
23670   */
23671  createOrUpdateVertexFeature_(t, i, s) {
23672    let n = this.vertexFeature_;
23673    return n ? n.getGeometry().setCoordinates(t) : (n = new Di(new yi(t)), this.vertexFeature_ = n, this.overlay_.getSource().addFeature(n)), n.set("features", i), n.set("geometries", s), n;
23674  }
23675  /**
23676   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.
23677   * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
23678   * @return {boolean} `false` to stop event propagation.
23679   */
23680  handleEvent(t) {
23681    if (!t.originalEvent)
23682      return !0;
23683    this.lastPointerEvent_ = t;
23684    let i;
23685    return !t.map.getView().getInteracting() && t.type == dt.POINTERMOVE && !this.handlingDownUpSequence && this.handlePointerMove_(t), this.vertexFeature_ && this.deleteCondition_(t) && (t.type != dt.SINGLECLICK || !this.ignoreNextSingleClick_ ? i = this.removePoint() : i = !0), t.type == dt.SINGLECLICK && (this.ignoreNextSingleClick_ = !1), super.handleEvent(t) && !i;
23686  }
23687  /**
23688   * Handle pointer drag events.
23689   * @param {import("../MapBrowserEvent.js").default} evt Event.
23690   */
23691  handleDragEvent(t) {
23692    this.ignoreNextSingleClick_ = !1, this.willModifyFeatures_(t, this.dragSegments_);
23693    const i = [
23694      t.coordinate[0] + this.delta_[0],
23695      t.coordinate[1] + this.delta_[1]
23696    ], s = [], n = [];
23697    for (let r = 0, o = this.dragSegments_.length; r < o; ++r) {
23698      const a = this.dragSegments_[r], l = a[0], h = l.feature;
23699      s.includes(h) || s.push(h);
23700      const c = l.geometry;
23701      n.includes(c) || n.push(c);
23702      const u = l.depth;
23703      let d;
23704      const f = l.segment, g = a[1];
23705      for (; i.length < c.getStride(); )
23706        i.push(f[g][i.length]);
23707      switch (c.getType()) {
23708        case "Point":
23709          d = i, f[0] = i, f[1] = i;
23710          break;
23711        case "MultiPoint":
23712          d = c.getCoordinates(), d[l.index] = i, f[0] = i, f[1] = i;
23713          break;
23714        case "LineString":
23715          d = c.getCoordinates(), d[l.index + g] = i, f[g] = i;
23716          break;
23717        case "MultiLineString":
23718          d = c.getCoordinates(), d[u[0]][l.index + g] = i, f[g] = i;
23719          break;
23720        case "Polygon":
23721          d = c.getCoordinates(), d[u[0]][l.index + g] = i, f[g] = i;
23722          break;
23723        case "MultiPolygon":
23724          d = c.getCoordinates(), d[u[1]][u[0]][l.index + g] = i, f[g] = i;
23725          break;
23726        case "Circle":
23727          if (f[0] = i, f[1] = i, l.index === Ju)
23728            this.changingFeature_ = !0, c.setCenter(i), this.changingFeature_ = !1;
23729          else {
23730            this.changingFeature_ = !0, t.map.getView().getProjection();
23731            let _ = bo(
23732              Pt(c.getCenter()),
23733              Pt(i)
23734            );
23735            c.setRadius(_), this.changingFeature_ = !1;
23736          }
23737          break;
23738      }
23739      d && this.setGeometryCoordinates_(c, d);
23740    }
23741    this.createOrUpdateVertexFeature_(i, s, n);
23742  }
23743  /**
23744   * Handle pointer down events.
23745   * @param {import("../MapBrowserEvent.js").default} evt Event.
23746   * @return {boolean} If the event was consumed.
23747   */
23748  handleDownEvent(t) {
23749    if (!this.condition_(t))
23750      return !1;
23751    const i = t.coordinate;
23752    this.handlePointerAtPixel_(t.pixel, t.map, i), this.dragSegments_.length = 0, this.featuresBeingModified_ = null;
23753    const s = this.vertexFeature_;
23754    if (s) {
23755      t.map.getView().getProjection();
23756      const n = [], r = s.getGeometry().getCoordinates(), o = ce([r]), a = this.rBush_.getInExtent(o), l = {};
23757      a.sort(Yb);
23758      for (let h = 0, c = a.length; h < c; ++h) {
23759        const u = a[h], d = u.segment;
23760        let f = ot(u.geometry);
23761        const g = u.depth;
23762        if (g && (f += "-" + g.join("-")), l[f] || (l[f] = new Array(2)), u.geometry.getType() === "Circle" && u.index === Qn) {
23763          const _ = ed(
23764            i,
23765            u
23766          );
23767          Fe(_, r) && !l[f][0] && (this.dragSegments_.push([u, 0]), l[f][0] = u);
23768          continue;
23769        }
23770        if (Fe(d[0], r) && !l[f][0]) {
23771          this.dragSegments_.push([u, 0]), l[f][0] = u;
23772          continue;
23773        }
23774        if (Fe(d[1], r) && !l[f][1]) {
23775          if (l[f][0] && l[f][0].index === 0) {
23776            let _ = u.geometry.getCoordinates();
23777            switch (u.geometry.getType()) {
23778              case "LineString":
23779              case "MultiLineString":
23780                continue;
23781              case "MultiPolygon":
23782                _ = _[g[1]];
23783              case "Polygon":
23784                if (u.index !== _[g[0]].length - 2)
23785                  continue;
23786                break;
23787            }
23788          }
23789          this.dragSegments_.push([u, 1]), l[f][1] = u;
23790          continue;
23791        }
23792        ot(d) in this.vertexSegments_ && !l[f][0] && !l[f][1] && this.insertVertexCondition_(t) && n.push(u);
23793      }
23794      n.length && this.willModifyFeatures_(t, [n]);
23795      for (let h = n.length - 1; h >= 0; --h)
23796        this.insertVertex_(n[h], r);
23797    }
23798    return !!this.vertexFeature_;
23799  }
23800  /**
23801   * Handle pointer up events.
23802   * @param {import("../MapBrowserEvent.js").default} evt Event.
23803   * @return {boolean} If the event was consumed.
23804   */
23805  handleUpEvent(t) {
23806    for (let i = this.dragSegments_.length - 1; i >= 0; --i) {
23807      const s = this.dragSegments_[i][0], n = s.geometry;
23808      if (n.getType() === "Circle") {
23809        const r = n.getCenter(), o = s.featureSegments[0], a = s.featureSegments[1];
23810        o.segment[0] = r, o.segment[1] = r, a.segment[0] = r, a.segment[1] = r, this.rBush_.update(go(r), o);
23811        let l = n;
23812        this.rBush_.update(
23813          l.getExtent(),
23814          a
23815        );
23816      } else
23817        this.rBush_.update(ce(s.segment), s);
23818    }
23819    return this.featuresBeingModified_ && (this.dispatchEvent(
23820      new Ka(
23821        Ya.MODIFYEND,
23822        this.featuresBeingModified_,
23823        t
23824      )
23825    ), this.featuresBeingModified_ = null), !1;
23826  }
23827  /**
23828   * @param {import("../MapBrowserEvent.js").default} evt Event.
23829   * @private
23830   */
23831  handlePointerMove_(t) {
23832    this.lastPixel_ = t.pixel, this.handlePointerAtPixel_(t.pixel, t.map, t.coordinate);
23833  }
23834  /**
23835   * @param {import("../pixel.js").Pixel} pixel Pixel
23836   * @param {import("../Map.js").default} map Map.
23837   * @param {import("../coordinate.js").Coordinate} [coordinate] The pixel Coordinate.
23838   * @private
23839   */
23840  handlePointerAtPixel_(t, i, s) {
23841    const n = s || i.getCoordinateFromPixel(t);
23842    i.getView().getProjection();
23843    const r = function(l, h) {
23844      return td(n, l) - td(n, h);
23845    };
23846    let o, a;
23847    if (this.hitDetection_) {
23848      const l = typeof this.hitDetection_ == "object" ? (h) => h === this.hitDetection_ : void 0;
23849      i.forEachFeatureAtPixel(
23850        t,
23851        (h, c, u) => {
23852          u && (u = new yi(
23853            Cs(u.getCoordinates())
23854          ));
23855          const d = u || h.getGeometry();
23856          if (d.getType() === "Point" && h instanceof Di && this.features_.getArray().includes(h)) {
23857            a = /** @type {Point} */
23858            d;
23859            const f = (
23860              /** @type {Point} */
23861              h.getGeometry().getFlatCoordinates().slice(0, 2)
23862            );
23863            o = [
23864              {
23865                feature: h,
23866                geometry: a,
23867                segment: [f, f]
23868              }
23869            ];
23870          }
23871          return !0;
23872        },
23873        { layerFilter: l }
23874      );
23875    }
23876    if (!o) {
23877      const l = He(
23878        go(n, Qu)
23879      ), h = i.getView().getResolution() * this.pixelTolerance_, c = Qo(
23880        Ms(l, h, Qu)
23881      );
23882      o = this.rBush_.getInExtent(c);
23883    }
23884    if (o && o.length > 0) {
23885      const l = o.sort(r)[0], h = l.segment;
23886      let c = ed(n, l);
23887      const u = i.getPixelFromCoordinate(c);
23888      let d = bo(t, u);
23889      if (a || d <= this.pixelTolerance_) {
23890        const f = {};
23891        if (f[ot(h)] = !0, this.snapToPointer_ || (this.delta_[0] = c[0] - n[0], this.delta_[1] = c[1] - n[1]), l.geometry.getType() === "Circle" && l.index === Qn)
23892          this.snappedToVertex_ = !0, this.createOrUpdateVertexFeature_(
23893            c,
23894            [l.feature],
23895            [l.geometry]
23896          );
23897        else {
23898          const g = i.getPixelFromCoordinate(h[0]), _ = i.getPixelFromCoordinate(h[1]), m = _i(u, g), p = _i(u, _);
23899          d = Math.sqrt(Math.min(m, p)), this.snappedToVertex_ = d <= this.pixelTolerance_, this.snappedToVertex_ && (c = m > p ? h[1] : h[0]), this.createOrUpdateVertexFeature_(
23900            c,
23901            [l.feature],
23902            [l.geometry]
23903          );
23904          const y = {};
23905          y[ot(l.geometry)] = !0;
23906          for (let v = 1, E = o.length; v < E; ++v) {
23907            const C = o[v].segment;
23908            if (Fe(h[0], C[0]) && Fe(h[1], C[1]) || Fe(h[0], C[1]) && Fe(h[1], C[0])) {
23909              const w = ot(o[v].geometry);
23910              w in y || (y[w] = !0, f[ot(C)] = !0);
23911            } else
23912              break;
23913          }
23914        }
23915        this.vertexSegments_ = f;
23916        return;
23917      }
23918    }
23919    this.vertexFeature_ && (this.overlay_.getSource().removeFeature(this.vertexFeature_), this.vertexFeature_ = null);
23920  }
23921  /**
23922   * @param {SegmentData} segmentData Segment data.
23923   * @param {import("../coordinate.js").Coordinate} vertex Vertex.
23924   * @private
23925   */
23926  insertVertex_(t, i) {
23927    const s = t.segment, n = t.feature, r = t.geometry, o = t.depth, a = t.index;
23928    let l;
23929    for (; i.length < r.getStride(); )
23930      i.push(0);
23931    switch (r.getType()) {
23932      case "MultiLineString":
23933        l = r.getCoordinates(), l[o[0]].splice(a + 1, 0, i);
23934        break;
23935      case "Polygon":
23936        l = r.getCoordinates(), l[o[0]].splice(a + 1, 0, i);
23937        break;
23938      case "MultiPolygon":
23939        l = r.getCoordinates(), l[o[1]][o[0]].splice(a + 1, 0, i);
23940        break;
23941      case "LineString":
23942        l = r.getCoordinates(), l.splice(a + 1, 0, i);
23943        break;
23944      default:
23945        return;
23946    }
23947    this.setGeometryCoordinates_(r, l);
23948    const h = this.rBush_;
23949    h.remove(t), this.updateSegmentIndices_(r, a, o, 1);
23950    const c = {
23951      segment: [s[0], i],
23952      feature: n,
23953      geometry: r,
23954      depth: o,
23955      index: a
23956    };
23957    h.insert(ce(c.segment), c), this.dragSegments_.push([c, 1]);
23958    const u = {
23959      segment: [i, s[1]],
23960      feature: n,
23961      geometry: r,
23962      depth: o,
23963      index: a + 1
23964    };
23965    h.insert(ce(u.segment), u), this.dragSegments_.push([u, 0]), this.ignoreNextSingleClick_ = !0;
23966  }
23967  /**
23968   * Removes the vertex currently being pointed.
23969   * @return {boolean} True when a vertex was removed.
23970   * @api
23971   */
23972  removePoint() {
23973    if (this.lastPointerEvent_ && this.lastPointerEvent_.type != dt.POINTERDRAG) {
23974      const t = this.lastPointerEvent_;
23975      this.willModifyFeatures_(t, this.dragSegments_);
23976      const i = this.removeVertex_();
23977      return this.featuresBeingModified_ && this.dispatchEvent(
23978        new Ka(
23979          Ya.MODIFYEND,
23980          this.featuresBeingModified_,
23981          t
23982        )
23983      ), this.featuresBeingModified_ = null, i;
23984    }
23985    return !1;
23986  }
23987  /**
23988   * Removes a vertex from all matching features.
23989   * @return {boolean} True when a vertex was removed.
23990   * @private
23991   */
23992  removeVertex_() {
23993    const t = this.dragSegments_, i = {};
23994    let s = !1, n, r, o, a, l, h, c, u, d, f, g;
23995    for (l = t.length - 1; l >= 0; --l)
23996      o = t[l], f = o[0], g = ot(f.feature), f.depth && (g += "-" + f.depth.join("-")), g in i || (i[g] = {}), o[1] === 0 ? (i[g].right = f, i[g].index = f.index) : o[1] == 1 && (i[g].left = f, i[g].index = f.index + 1);
23997    for (g in i) {
23998      switch (d = i[g].right, c = i[g].left, h = i[g].index, u = h - 1, c !== void 0 ? f = c : f = d, u < 0 && (u = 0), a = f.geometry, r = a.getCoordinates(), n = r, s = !1, a.getType()) {
23999        case "MultiLineString":
24000          r[f.depth[0]].length > 2 && (r[f.depth[0]].splice(h, 1), s = !0);
24001          break;
24002        case "LineString":
24003          r.length > 2 && (r.splice(h, 1), s = !0);
24004          break;
24005        case "MultiPolygon":
24006          n = n[f.depth[1]];
24007        case "Polygon":
24008          n = n[f.depth[0]], n.length > 4 && (h == n.length - 1 && (h = 0), n.splice(h, 1), s = !0, h === 0 && (n.pop(), n.push(n[0]), u = n.length - 1));
24009          break;
24010      }
24011      if (s) {
24012        this.setGeometryCoordinates_(a, r);
24013        const _ = [];
24014        if (c !== void 0 && (this.rBush_.remove(c), _.push(c.segment[0])), d !== void 0 && (this.rBush_.remove(d), _.push(d.segment[1])), c !== void 0 && d !== void 0) {
24015          const m = {
24016            depth: f.depth,
24017            feature: f.feature,
24018            geometry: f.geometry,
24019            index: u,
24020            segment: _
24021          };
24022          this.rBush_.insert(
24023            ce(m.segment),
24024            m
24025          );
24026        }
24027        this.updateSegmentIndices_(a, h, f.depth, -1), this.vertexFeature_ && (this.overlay_.getSource().removeFeature
24027(this.vertexFeature_), this.vertexFeature_ = null), t.length = 0;
24028      }
24029    }
24030    return s;
24031  }
24032  /**
24033   * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
24034   * @param {Array} coordinates Coordinates.
24035   * @private
24036   */
24037  setGeometryCoordinates_(t, i) {
24038    this.changingFeature_ = !0, t.setCoordinates(i), this.changingFeature_ = !1;
24039  }
24040  /**
24041   * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
24042   * @param {number} index Index.
24043   * @param {Array<number>|undefined} depth Depth.
24044   * @param {number} delta Delta (1 or -1).
24045   * @private
24046   */
24047  updateSegmentIndices_(t, i, s, n) {
24048    this.rBush_.forEachInExtent(
24049      t.getExtent(),
24050      function(r) {
24051        r.geometry === t && (s === void 0 || r.depth === void 0 || wi(r.depth, s)) && r.index > i && (r.index += n);
24052      }
24053    );
24054  }
24055}
24056function Yb(e, t) {
24057  return e.index - t.index;
24058}
24059function td(e, t, i) {
24060  const s = t.geometry;
24061  if (s.getType() === "Circle") {
24062    let r = (
24063      /** @type {import("../geom/Circle.js").default} */
24064      s
24065    );
24066    if (t.index === Qn) {
24067      const o = _i(
24068        r.getCenter(),
24069        Pt(e)
24070      ), a = Math.sqrt(o) - r.getRadius();
24071      return a * a;
24072    }
24073  }
24074  const n = Pt(e);
24075  return un[0] = Pt(t.segment[0]), un[1] = Pt(t.segment[1]), h1(n, un);
24076}
24077function ed(e, t, i) {
24078  const s = t.geometry;
24079  if (s.getType() === "Circle" && t.index === Qn)
24080    return Cs(
24081      /** @type {import("../geom/Circle.js").default} */
24082      s.getClosestPoint(
24083        Pt(e)
24084      )
24085    );
24086  const n = Pt(e);
24087  return un[0] = Pt(t.segment[0]), un[1] = Pt(t.segment[1]), Cs(
24088    Zl(n, un)
24089  );
24090}
24091function Kb() {
24092  const e = Rg();
24093  return function(t, i) {
24094    return e.Point;
24095  };
24096}
24097const qb = $b, ne = na({
24098  geometry: null,
24099  // GeoJSON geometry: { type, coordinates } — Point | LineString | Polygon
24100  hasPoint: !1,
24101  resetSeq: 0
24102  // bumped by requestReportReset() so the map can clear its geometry
24103});
24104function id(e) {
24105  ne.geometry = e, ne.hasPoint = !0;
24106}
24107function sd() {
24108  ne.geometry = null, ne.hasPoint = !1;
24109}
24110function Vb() {
24111  ne.geometry = null, ne.hasPoint = !1, ne.resetSeq++;
24112}
24113class Ma extends es {
24114  /**
24115   * @param {!import("../coordinate.js").Coordinate} center Center.
24116   *     For internal use, flat coordinates in combination with `layout` and no
24117   *     `radius` are also accepted.
24118   * @param {number} [radius] Radius.
24119   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24120   */
24121  constructor(t, i, s) {
24122    super(), s !== void 0 && i === void 0 ? this.setFlatCoordinates(s, t) : (i = i || 0, this.setCenterAndRadius(t, i, s));
24123  }
24124  /**
24125   * Make a complete copy of the geometry.
24126   * @return {!Circle} Clone.
24127   * @api
24128   */
24129  clone() {
24130    const t = new Ma(
24131      this.flatCoordinates.slice(),
24132      void 0,
24133      this.layout
24134    );
24135    return t.applyProperties(this), t;
24136  }
24137  /**
24138   * @param {number} x X.
24139   * @param {number} y Y.
24140   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
24141   * @param {number} minSquaredDistance Minimum squared distance.
24142   * @return {number} Minimum squared distance.
24143   */
24144  closestPointXY(t, i, s, n) {
24145    const r = this.flatCoordinates, o = t - r[0], a = i - r[1], l = o * o + a * a;
24146    if (l < n) {
24147      if (l === 0)
24148        for (let h = 0; h < this.stride; ++h)
24149          s[h] = r[h];
24150      else {
24151        const h = this.getRadius() / Math.sqrt(l);
24152        s[0] = r[0] + h * o, s[1] = r[1] + h * a;
24153        for (let c = 2; c < this.stride; ++c)
24154          s[c] = r[c];
24155      }
24156      return s.length = this.stride, l;
24157    }
24158    return n;
24159  }
24160  /**
24161   * @param {number} x X.
24162   * @param {number} y Y.
24163   * @return {boolean} Contains (x, y).
24164   */
24165  containsXY(t, i) {
24166    const s = this.flatCoordinates, n = t - s[0], r = i - s[1];
24167    return n * n + r * r <= this.getRadiusSquared_();
24168  }
24169  /**
24170   * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.
24171   * @return {import("../coordinate.js").Coordinate} Center.
24172   * @api
24173   */
24174  getCenter() {
24175    return this.flatCoordinates.slice(0, this.stride);
24176  }
24177  /**
24178   * @param {import("../extent.js").Extent} extent Extent.
24179   * @protected
24180   * @return {import("../extent.js").Extent} extent Extent.
24181   */
24182  computeExtent(t) {
24183    const i = this.flatCoordinates, s = i[this.stride] - i[0];
24184    return ei(
24185      i[0] - s,
24186      i[1] - s,
24187      i[0] + s,
24188      i[1] + s,
24189      t
24190    );
24191  }
24192  /**
24193   * Return the radius of the circle.
24194   * @return {number} Radius.
24195   * @api
24196   */
24197  getRadius() {
24198    return Math.sqrt(this.getRadiusSquared_());
24199  }
24200  /**
24201   * @private
24202   * @return {number} Radius squared.
24203   */
24204  getRadiusSquared_() {
24205    const t = this.flatCoordinates[this.stride] - this.flatCoordinates[0], i = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];
24206    return t * t + i * i;
24207  }
24208  /**
24209   * Get the type of this geometry.
24210   * @return {import("./Geometry.js").Type} Geometry type.
24211   * @api
24212   */
24213  getType() {
24214    return "Circle";
24215  }
24216  /**
24217   * Test if the geometry and the passed extent intersect.
24218   * @param {import("../extent.js").Extent} extent Extent.
24219   * @return {boolean} `true` if the geometry and the extent intersect.
24220   * @api
24221   */
24222  intersectsExtent(t) {
24223    const i = this.getExtent();
24224    if (ee(t, i)) {
24225      const s = this.getCenter();
24226      return t[0] <= s[0] && t[2] >= s[0] || t[1] <= s[1] && t[3] >= s[1] ? !0 : Hl(t, this.intersectsCoordinate.bind(this));
24227    }
24228    return !1;
24229  }
24230  /**
24231   * Set the center of the circle as {@link module:ol/coordinate~Co
24231ordinate coordinate}.
24232   * @param {import("../coordinate.js").Coordinate} center Center.
24233   * @api
24234   */
24235  setCenter(t) {
24236    const i = this.stride, s = this.flatCoordinates[i] - this.flatCoordinates[0], n = t.slice();
24237    n[i] = n[0] + s;
24238    for (let r = 1; r < i; ++r)
24239      n[i + r] = t[r];
24240    this.setFlatCoordinates(this.layout, n), this.changed();
24241  }
24242  /**
24243   * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as
24244   * number) of the circle.
24245   * @param {!import("../coordinate.js").Coordinate} center Center.
24246   * @param {number} radius Radius.
24247   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24248   * @api
24249   */
24250  setCenterAndRadius(t, i, s) {
24251    this.setLayout(s, t, 0), this.flatCoordinates || (this.flatCoordinates = []);
24252    const n = this.flatCoordinates;
24253    let r = eg(n, 0, t, this.stride);
24254    n[r++] = n[0] + i;
24255    for (let o = 1, a = this.stride; o < a; ++o)
24256      n[r++] = n[o];
24257    n.length = r, this.changed();
24258  }
24259  getCoordinates() {
24260    return null;
24261  }
24262  setCoordinates(t, i) {
24263  }
24264  /**
24265   * Set the radius of the circle. The radius is in the units of the projection.
24266   * @param {number} radius Radius.
24267   * @api
24268   */
24269  setRadius(t) {
24270    this.flatCoordinates[this.stride] = this.flatCoordinates[0] + t, this.changed();
24271  }
24272  /**
24273   * Rotate the geometry around a given coordinate. This modifies the geometry
24274   * coordinates in place.
24275   * @param {number} angle Rotation angle in counter-clockwise radians.
24276   * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
24277   * @api
24278   */
24279  rotate(t, i) {
24280    const s = this.getCenter(), n = this.getStride();
24281    this.setCenter(
24282      Ph(s, 0, s.length, n, t, i, s)
24283    ), this.changed();
24284  }
24285}
24286Ma.prototype.transform;
24287const Hb = Ma;
24288class Uo extends tg {
24289  /**
24290   * @param {Array<Geometry>} [geometries] Geometries.
24291   */
24292  constructor(t) {
24293    super(), this.geometries_ = t || null, this.changeEventsKeys_ = [], this.listenGeometriesChange_();
24294  }
24295  /**
24296   * @private
24297   */
24298  unlistenGeometriesChange_() {
24299    this.changeEventsKeys_.forEach(Mt), this.changeEventsKeys_.length = 0;
24300  }
24301  /**
24302   * @private
24303   */
24304  listenGeometriesChange_() {
24305    if (this.geometries_)
24306      for (let t = 0, i = this.geometries_.length; t < i; ++t)
24307        this.changeEventsKeys_.push(
24308          lt(this.geometries_[t], et.CHANGE, this.changed, this)
24309        );
24310  }
24311  /**
24312   * Make a complete copy of the geometry.
24313   * @return {!GeometryCollection} Clone.
24314   * @api
24315   */
24316  clone() {
24317    const t = new Uo(null);
24318    return t.setGeometries(this.geometries_), t.applyProperties(this), t;
24319  }
24320  /**
24321   * @param {number} x X.
24322   * @param {number} y Y.
24323   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
24324   * @param {number} minSquaredDistance Minimum squared distance.
24325   * @return {number} Minimum squared distance.
24326   */
24327  closestPointXY(t, i, s, n) {
24328    if (n < Ts(this.getExtent(), t, i))
24329      return n;
24330    const r = this.geometries_;
24331    for (let o = 0, a = r.length; o < a; ++o)
24332      n = r[o].closestPointXY(
24333        t,
24334        i,
24335        s,
24336        n
24337      );
24338    return n;
24339  }
24340  /**
24341   * @param {number} x X.
24342   * @param {number} y Y.
24343   * @return {boolean} Contains (x, y).
24344   */
24345  containsXY(t, i) {
24346    const s = this.geometries_;
24347    for (let n = 0, r = s.length; n < r; ++n)
24348      if (s[n].containsXY(t, i))
24349        return !0;
24350    return !1;
24351  }
24352  /**
24353   * @param {import("../extent.js").Extent} extent Extent.
24354   * @protected
24355   * @return {import("../extent.js").Extent} extent Extent.
24356   */
24357  computeExtent(t) {
24358    Tn(t);
24359    const i = this.geometries_;
24360    for (let s = 0, n = i.length; s < n; ++s)
24361      jd(t, i[s].getExtent());
24362    return t;
24363  }
24364  /**
24365   * Return the geometries that make up this geometry collection.
24366   * @return {Array<Geometry>} Geometries.
24367   * @api
24368   */
24369  getGeometries() {
24370    return nd(this.geometries_);
24371  }
24372  /**
24373   * @return {Array<Geometry>} Geometries.
24374   */
24375  getGeometriesArray() {
24376    return this.geometries_;
24377  }
24378  /**
24379   * @return {Array<Geometry>} Geometries.
24380   */
24381  getGeometriesArrayRecursive() {
24382    let t = [];
24383    const i = this.geometries_;
24384    for (let s = 0, n = i.length; s < n; ++s)
24385      i[s].getType() === this.getType() ? t = t.concat(
24386        /** @type {GeometryCollection} */
24387        i[s].getGeometriesArrayRecursive()
24388      ) : t.push(i[s]);
24389    return t;
24390  }
24391  /**
24392   * Create a simplified version of this geometry using the Douglas Peucker algorithm.
24393   * @param {number} squaredTolerance Squared tolerance.
24394   * @return {GeometryCollection} Simplified GeometryCollection.
24395   */
24396  getSimplifiedGeometry(t) {
24397    if (this.simplifiedGeometryRevision !== this.getRevision() && (this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = this.getRevision()), t 
24397< 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && t < this.simplifiedGeometryMaxMinSquaredTolerance)
24398      return this;
24399    const i = [], s = this.geometries_;
24400    let n = !1;
24401    for (let r = 0, o = s.length; r < o; ++r) {
24402      const a = s[r], l = a.getSimplifiedGeometry(t);
24403      i.push(l), l !== a && (n = !0);
24404    }
24405    if (n) {
24406      const r = new Uo(null);
24407      return r.setGeometriesArray(i), r;
24408    }
24409    return this.simplifiedGeometryMaxMinSquaredTolerance = t, this;
24410  }
24411  /**
24412   * Get the type of this geometry.
24413   * @return {import("./Geometry.js").Type} Geometry type.
24414   * @api
24415   */
24416  getType() {
24417    return "GeometryCollection";
24418  }
24419  /**
24420   * Test if the geometry and the passed extent intersect.
24421   * @param {import("../extent.js").Extent} extent Extent.
24422   * @return {boolean} `true` if the geometry and the extent intersect.
24423   * @api
24424   */
24425  intersectsExtent(t) {
24426    const i = this.geometries_;
24427    for (let s = 0, n = i.length; s < n; ++s)
24428      if (i[s].intersectsExtent(t))
24429        return !0;
24430    return !1;
24431  }
24432  /**
24433   * @return {boolean} Is empty.
24434   */
24435  isEmpty() {
24436    return this.geometries_.length === 0;
24437  }
24438  /**
24439   * Rotate the geometry around a given coordinate. This modifies the geometry
24440   * coordinates in place.
24441   * @param {number} angle Rotation angle in radians.
24442   * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
24443   * @api
24444   */
24445  rotate(t, i) {
24446    const s = this.geometries_;
24447    for (let n = 0, r = s.length; n < r; ++n)
24448      s[n].rotate(t, i);
24449    this.changed();
24450  }
24451  /**
24452   * Scale the geometry (with an optional origin).  This modifies the geometry
24453   * coordinates in place.
24454   * @abstract
24455   * @param {number} sx The scaling factor in the x-direction.
24456   * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
24457   * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
24458   *     of the geometry extent).
24459   * @api
24460   */
24461  scale(t, i, s) {
24462    s || (s = ii(this.getExtent()));
24463    const n = this.geometries_;
24464    for (let r = 0, o = n.length; r < o; ++r)
24465      n[r].scale(t, i, s);
24466    this.changed();
24467  }
24468  /**
24469   * Set the geometries that make up this geometry collection.
24470   * @param {Array<Geometry>} geometries Geometries.
24471   * @api
24472   */
24473  setGeometries(t) {
24474    this.setGeometriesArray(nd(t));
24475  }
24476  /**
24477   * @param {Array<Geometry>} geometries Geometries.
24478   */
24479  setGeometriesArray(t) {
24480    this.unlistenGeometriesChange_(), this.geometries_ = t, this.listenGeometriesChange_(), this.changed();
24481  }
24482  /**
24483   * Apply a transform function to the coordinates of the geometry.
24484   * The geometry is modified in place.
24485   * If you do not want the geometry modified in place, first `clone()` it and
24486   * then use this function on the clone.
24487   * @param {import("../proj.js").TransformFunction} transformFn Transform function.
24488   * Called with a flat array of geometry coordinates.
24489   * @api
24490   */
24491  applyTransform(t) {
24492    const i = this.geometries_;
24493    for (let s = 0, n = i.length; s < n; ++s)
24494      i[s].applyTransform(t);
24495    this.changed();
24496  }
24497  /**
24498   * Translate the geometry.  This modifies the geometry coordinates in place.  If
24499   * instead you want a new geometry, first `clone()` this geometry.
24500   * @param {number} deltaX Delta X.
24501   * @param {number} deltaY Delta Y.
24502   * @api
24503   */
24504  translate(t, i) {
24505    const s = this.geometries_;
24506    for (let n = 0, r = s.length; n < r; ++n)
24507      s[n].translate(t, i);
24508    this.changed();
24509  }
24510  /**
24511   * Clean up.
24512   */
24513  disposeInternal() {
24514    this.unlistenGeometriesChange_(), super.disposeInternal();
24515  }
24516}
24517function nd(e) {
24518  const t = [];
24519  for (let i = 0, s = e.length; i < s; ++i)
24520    t.push(e[i].clone());
24521  return t;
24522}
24523const Ug = Uo;
24524class Xo extends es {
24525  /**
24526   * @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
24527   *     Coordinates or LineString geometries. (For internal use, flat coordinates in
24528   *     combination with `layout` and `ends` are also accepted.)
24529   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24530   * @param {Array<number>} [ends] Flat coordinate ends for internal use.
24531   */
24532  constructor(t, i, s) {
24533    if (super(), this.ends_ = [], this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, Array.isArray(t[0]))
24534      this.setCoordinates(
24535        /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */
24536        t,
24537        i
24538      );
24539    else if (i !== void 0 && s)
24540      this.setFlatCoordinates(
24541        i,
24542        /** @type {Array<number>} */
24543        t
24544      ), this.ends_ = s;
24545    else {
24546      let n = this.getLayout();
24547      const r = (
24548        /** @type {Array<LineString>} */
24549        t
24550      ), o = [], a = [];
24551      for (let l = 0, h = r.length; l < h; ++l) {
24552        const c = r[l];
24553        l === 0 && (n = c.getLayout()), pi(o, c.getFlatCoordinates()), a.push(o.length);
24554      }
24555      this.setFlatCoordinates(n, o), this.ends_ = a;
24556    }
24557  }
24558  /**
24559   * Append the passed linestring to the multilinestring.
24560   * @param {LineString} lineString LineString.
24561   * @api
24562   */
24563  appendLineString(t) {
24564    this.flatCoordinates ? pi(this.flatCoordinates, t.getFlatCoordinates().slice()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.ends_.push(this.flatCoordinates.length), this.changed();
24565  }
24566  /**
24567   * Make a complete copy of the geometry.
24568   * @return {!MultiLineString} Clone.
24569   * @api
24570   */
24571  clone() {
24572    const t = new Xo(
24573      this.flatCoordinates.slice(),
24574      this.layout,
24575      this.ends_.slice()
24576    );
24577    return t.applyProperties(this), t;
24578  }
24579  /**
24580   * @param {number} x X.
24581   * @param {number} y Y.
24582   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
24583   * @param {number} minSquaredDistance Minimum squared distance.
24584   * @return {number} Minimum squared distance.
24585   */
24586  closestPointXY(t, i, s, n) {
24587    return n < Ts(this.getExtent(), t, i) ? n : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
24588      Lh(
24589        this.flatCoordinates,
24590        0,
24591        this.ends_,
24592        this.stride,
24593        0
24594      )
24595    ), this.maxDeltaRevision_ = this.getRevision()), Fh(
24596      this.flatCoordinates,
24597      0,
24598      this.ends_,
24599      this.stride,
24600      this.maxDelta_,
24601      !1,
24602      t,
24603      i,
24604      s,
24605      n
24606    ));
24607  }
24608  /**
24609   * Returns the coordinate at `m` using linear interpolation, or `null` if no
24610   * such coordinate exists.
24611   *
24612   * `extrapolate` controls extrapolation beyond the range of Ms in the
24613   * MultiLineString. If `extrapolate` is `true` then Ms less than the first
24614   * M will return the first coordinate and Ms greater than the last M will
24615   * return the last coordinate.
24616   *
24617   * `interpolate` controls interpolation between consecutive LineStrings
24618   * within the MultiLineString. If `interpolate` is `true` the coordinates
24619   * will be linearly interpolated between the last coordinate of one LineString
24620   * and the first coordinate of the next LineString.  If `interpolate` is
24621   * `false` then the function will return `null` for Ms falling between
24622   * LineStrings.
24623   *
24624   * @param {number} m M.
24625   * @param {boolean} [extrapolate] Extrapolate. Default is `false`.
24626   * @param {boolean} [interpolate] Interpolate. Default is `false`.
24627   * @return {import("../coordinate.js").Coordinate|null} Coordinate.
24628   * @api
24629   */
24630  getCoordinateAtM(t, i, s) {
24631    return this.layout != "XYM" && this.layout != "XYZM" || this.flatCoordinates.length === 0 ? null : (i = i !== void 0 ? i : !1, s = s !== void 0 ? s : !1, MC(
24632      this.flatCoordinates,
24633      0,
24634      this.ends_,
24635      this.stride,
24636      t,
24637      i,
24638      s
24639    ));
24640  }
24641  /**
24642   * Return the coordinates of the multilinestring.
24643   * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
24644   * @api
24645   */
24646  getCoordinates() {
24647    return cr(
24648      this.flatCoordinates,
24649      0,
24650      this.ends_,
24651      this.stride
24652    );
24653  }
24654  /**
24655   * @return {Array<number>} Ends.
24656   */
24657  getEnds() {
24658    return this.ends_;
24659  }
24660  /**
24661   * Return the linestring at the specified index.
24662   * @param {number} index Index.
24663   * @return {LineString} LineString.
24664   * @api
24665   */
24666  getLineString(t) {
24667    return t < 0 || this.ends_.length <= t ? null : new ys(
24668      this.flatCoordinates.slice(
24669        t === 0 ? 0 : this.ends_[t - 1],
24670        this.ends_[t]
24671      ),
24672      this.layout
24673    );
24674  }
24675  /**
24676   * Return the linestrings of this multilinestring.
24677   * @return {Array<LineString>} LineStrings.
24678   * @api
24679   */
24680  getLineStrings() {
24681    const t = this.flatCoordinates, i = this.ends_, s = this.layout, n = [];
24682    let r = 0;
24683    for (let o = 0, a = i.length; o < a; ++o) {
24684      const l = i[o], h = new ys(
24685        t.slice(r, l),
24686        s
24687      );
24688      n.push(h), r = l;
24689    }
24690    return n;
24691  }
24692  /**
24693   * @return {Array<number>} Flat midpoints.
24694   */
24695  getFlatMidpoints() {
24696    const t = [], i = this.flatCoordinates;
24697    let s = 0;
24698    const n = this.ends_, r = this.stride;
24699    for (let o = 0, a = n.length; o < a; ++o) {
24700      const l = n[o], h = bg(
24701        i,
24702        s,
24703        l,
24704        r,
24705        0.5
24706      );
24707      pi(t, h), s = l;
24708    }
24709    return t;
24710  }
24711  /**
24712   * @param {number} squaredTolerance Squared tolerance.
24713   * @return {MultiLineString} Simplified MultiLineString.
24714   * @protected
24715   */
24716  getSimplifiedGeometryInternal(t) {
24717    const i = [], s = [];
24718    return i.length = XE(
24719      this.flatCoordinates,
24720      0,
24721      this.ends_,
24722      this.stride,
24723      t,
24724      i,
24725      0,
24726      s
24727    ), new Xo(i, "XY", s);
24728  }
24729  /**
24730   * Get the type of this geometry.
24731   * @return {import("./Geometry.js").Type} Geometry type.
24732   * @api
24733   */
24734  getType() {
24735    return "MultiLineString";
24736  }
24737  /**
24738   * Test if the geometry and the passed extent intersect.
24739   * @param {import("../extent.js").Extent} extent Extent.
24740   * @return {boolean} `true` if the geometry and the extent intersect.
24741   * @api
24742   */
24743  intersectsExtent(t) {
24744    return ZE(
24745      this.flatCoordinates,
24746      0,
24747      this.ends_,
24748      this.stride,
24749      t
24750    );
24751  }
24752  /**
24753   * Set the coordinates of the multilinestring.
24754   * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
24755   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24756   * @api
24757   */
24758  setCoordinates(t, i) {
24759    this.setLayout(i, t, 2), this.flatCoordinates || (this.flatCoordinates = []);
24760    const s = kh(
24761      this.flatCoordinates,
24762      0,
24763      t,
24764      this.stride,
24765      this.ends_
24766    );
24767    this.flatCoordinates.length = s.length === 0 ? 0 : s[s.length - 1], this.changed();
24768  }
24769}
24770const sc = Xo;
24771class nc extends es {
24772  /**
24773   * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
24774   *     For internal use, flat coordinates in combination with `layout` are also accepted.
24775   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24776   */
24777  constructor(t, i) {
24778    super(), i && !Array.isArray(t[0]) ? this.setFlatCoordinates(
24779      i,
24780      /** @type {Array<number>} */
24781      t
24782    ) : this.setCoordinates(
24783      /** @type {Array<import("../coordinate.js").Coordinate>} */
24784      t,
24785      i
24786    );
24787  }
24788  /**
24789   * Append the passed point to this multipoint.
24790   * @param {Point} point Point.
24791   * @api
24792   */
24793  appendPoint(t) {
24794    this.flatCoordinates ? pi(this.flatCoordinates, t.getFlatCoordinates()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.changed();
24795  }
24796  /**
24797   * Make a complete copy of the geometry.
24798   * @return {!MultiPoint} Clone.
24799   * @api
24800   */
24801  clone() {
24802    const t = new nc(
24803      this.flatCoordinates.slice(),
24804      this.layout
24805    );
24806    return t.applyProperties(this), t;
24807  }
24808  /**
24809   * @param {number} x X.
24810   * @param {number} y Y.
24811   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
24812   * @param {number} minSquaredDistance Minimum squared distance.
24813   * @return {number} Minimum squared distance.
24814   */
24815  closestPointXY(t, i, s, n) {
24816    if (n < Ts(this.getExtent(), t, i))
24817      return n;
24818    const r = this.flatCoordinates, o = this.stride;
24819    for (let a = 0, l = r.length; a < l; a += o) {
24820      const h = gi(
24821        t,
24822        i,
24823        r[a],
24824        r[a + 1]
24825      );
24826      if (h < n) {
24827        n = h;
24828        for (let c = 0; c < o; ++c)
24829          s[c] = r[a + c];
24830        s.length = o;
24831      }
24832    }
24833    return n;
24834  }
24835  /**
24836   * Return the coordinates of the multipoint.
24837   * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
24838   * @api
24839   */
24840  getCoordinates() {
24841    return ji(
24842      this.flatCoordinates,
24843      0,
24844      this.flatCoordinates.length,
24845      this.stride
24846    );
24847  }
24848  /**
24849   * Return the point at the specified index.
24850   * @param {number} index Index.
24851   * @return {Point} Point.
24852   * @api
24853   */
24854  getPoint(t) {
24855    const i = this.flatCoordinates ? this.flatCoordinates.length / this.stride : 0;
24856    return t < 0 || i <= t ? null : new yi(
24857      this.flatCoordinates.slice(
24858        t * this.stride,
24859        (t + 1) * this.stride
24860      ),
24861      this.layout
24862    );
24863  }
24864  /**
24865   * Return the points of this multipoint.
24866   * @return {Array<Point>} Points.
24867   * @api
24868   */
24869  getPoints() {
24870    const t = this.flatCoordinates, i = this.layout, s = this.stride, n = [];
24871    for (let r = 0, o = t.length; r < o; r += s) {
24872      const a = new yi(t.slice(r, r + s), i);
24873      n.push(a);
24874    }
24875    return n;
24876  }
24877  /**
24878   * Get the type of this geometry.
24879   * @return {import("./Geometry.js").Type} Geometry type.
24880   * @api
24881   */
24882  getType() {
24883    return "MultiPoint";
24884  }
24885  /**
24886   * Test if the geometry and the passed extent intersect.
24887   * @param {import("../extent.js").Extent} extent Extent.
24888   * @return {boolean} `true` if the geometry and the extent intersect.
24889   * @api
24890   */
24891  intersectsExtent(t) {
24892    const i = this.flatCoordinates, s = this.stride;
24893    for (let n = 0, r = i.length; n < r; n += s) {
24894      const o = i[n], a = i[n + 1];
24895      if (Vl(t, o, a))
24896        return !0;
24897    }
24898    return !1;
24899  }
24900  /**
24901   * Set the coordinates of the multipoint.
24902   * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
24903   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24904   * @api
24905   */
24906  setCoordinates(t, i) {
24907    this.setLayout(i, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = ga(
24908      this.flatCoordinates,
24909      0,
24910      t,
24911      this.stride
24912    ), this.changed();
24913  }
24914}
24915const rc = nc;
24916function Zb(e, t, i, s) {
24917  const n = [];
24918  let r = ve();
24919  for (let o = 0, a = i.length; o < a; ++o) {
24920    const l = i[o];
24921    r = zd(
24922      e,
24923      t,
24924      l[0],
24925      s
24926    ), n.push((r[0] + r[2]) / 2, (r[1] + r[3]) / 2), t = l[l.length - 1];
24927  }
24928  return n;
24929}
24930class $o extends es {
24931  /**
24932   * @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
24933   *     For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.
24934   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
24935   * @param {Array<Array<number>>} [endss] Array of ends for internal use with flat coordinates.
24936   */
24937  constructor(t, i, s) {
24938    if (super(), this.endss_ = [], this.flatInteriorPointsRevision_ = -1, this.flatInteriorPoints_ = null, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, this.orientedRevision_ = -1, this.orientedFlatCoordinates_ = null, !s && !Array.isArray(t[0])) {
24939      let n = this.getLayout();
24940      const r = (
24941        /** @type {Array<Polygon>} */
24942        t
24943      ), o = [], a = [];
24944      for (let l = 0, h = r.length; l < h; ++l) {
24945        const c = r[l];
24946        l === 0 && (n = c.getLayout());
24947        const u = o.length, d = c.getEnds();
24948        for (let f = 0, g = d.length; f < g; ++f)
24949          d[f] += u;
24950        pi(o, c.getFlatCoordinates()), a.push(d);
24951      }
24952      i = n, t = o, s = a;
24953    }
24954    i !== void 0 && s ? (this.setFlatCoordinates(
24955      i,
24956      /** @type {Array<number>} */
24957      t
24958    ), this.endss_ = s) : this.setCoordinates(
24959      /** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */
24960      t,
24961      i
24962    );
24963  }
24964  /**
24965   * Append the passed polygon to this multipolygon.
24966   * @param {Polygon} polygon Polygon.
24967   * @api
24968   */
24969  appendPolygon(t) {
24970    let i;
24971    if (!this.flatCoordinates)
24972      this.flatCoordinates = t.getFlatCoordinates().slice(), i = t.getEnds().slice(), this.endss_.push();
24973    else {
24974      const s = this.flatCoordinates.length;
24975      pi(this.flatCoordinates, t.getFlatCoordinates()), i = t.getEnds().slice();
24976      for (let n = 0, r = i.length; n < r; ++n)
24977        i[n] += s;
24978    }
24979    this.endss_.push(i), this.changed();
24980  }
24981  /**
24982   * Make a complete copy of the geometry.
24983   * @return {!MultiPolygon} Clone.
24984   * @api
24985   */
24986  clone() {
24987    const t = this.endss_.length, i = new Array(t);
24988    for (let n = 0; n < t; ++n)
24989      i[n] = this.endss_[n].slice();
24990    const s = new $o(
24991      this.flatCoordinates.slice(),
24992      this.layout,
24993      i
24994    );
24995    return s.applyProperties(this), s;
24996  }
24997  /**
24998   * @param {number} x X.
24999   * @param {number} y Y.
25000   * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
25001   * @param {number} minSquaredDistance Minimum squared distance.
25002   * @return {number} Minimum squared distance.
25003   */
25004  closestPointXY(t, i, s, n) {
25005    return n < Ts(this.getExtent(), t, i) ? n : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
25006      WE(
25007        this.flatCoordinates,
25008        0,
25009        this.endss_,
25010        this.stride,
25011        0
25012      )
25013    ), this.maxDeltaRevision_ = this.getRevision()), BE(
25014      this.getOrientedFlatCoordinates(),
25015      0,
25016      this.endss_,
25017      this.stride,
25018      this.maxDelta_,
25019      !0,
25020      t,
25021      i,
25022      s,
25023      n
25024    ));
25025  }
25026  /**
25027   * @param {number} x X.
25028   * @param {number} y Y.
25029   * @return {boolean} Contains (x, y).
25030   */
25031  containsXY(t, i) {
25032    return VE(
25033      this.getOrientedFlatCoordinates(),
25034      0,
25035      this.endss_,
25036      this.stride,
25037      t,
25038      i
25039    );
25040  }
25041  /**
25042   * Return the area of the multipolygon on projected plane.
25043   * @return {number} Area (on projected plane).
25044   * @api
25045   */
25046  getArea() {
25047    return KE(
25048      this.getOrientedFlatCoordinates(),
25049      0,
25050      this.endss_,
25051      this.stride
25052    );
25053  }
25054  /**
25055   * Get the coordinate array for this geometry.  This array has the structure
25056   * of a GeoJSON coordinate array for multi-polygons.
25057   *
25058   * @param {boolean} [right] Orient coordinates according to the right-hand
25059   *     rule (counter-clockwise for exterior and clockwise for interior rings).
25060   *     If `false`, coordinates will be oriented according to the left-hand rule
25061   *     (clockwise for exterior and counter-clockwise for interior rings).
25062   *     By default, coordinate orientation will depend on how the geometry was
25063   *     constructed.
25064   * @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
25065   * @api
25066   */
25067  getCoordinates(t) {
25068    let i;
25069    return t !== void 0 ? (i = this.getOrientedFlatCoordinates().slice(), Ru(
25070      i,
25071      0,
25072      this.endss_,
25073      this.stride,
25074      t
25075    )) : i = this.flatCoordinates, Tl(
25076      i,
25077      0,
25078      this.endss_,
25079      this.stride
25080    );
25081  }
25082  /**
25083   * @return {Array<Array<number>>} Endss.
25084   */
25085  getEndss() {
25086    return this.endss_;
25087  }
25088  /**
25089   * @return {Array<number>} Flat interior points.
25090   */
25091  getFlatInteriorPoints() {
25092    if (this.flatInteriorPointsRevision_ != this.getRevision()) {
25093      const t = Zb(
25094        this.flatCoordinates,
25095        0,
25096        this.endss_,
25097        this.stride
25098      );
25099      this.flatInteriorPoints_ = HE(
25100        this.getOrientedFlatCoordinates(),
25101        0,
25102        this.endss_,
25103        this.stride,
25104        t
25105      ), this.flatInteriorPointsRevision_ = this.getRevision();
25106    }
25107    return this.flatInteriorPoints_;
25108  }
25109  /**
25110   * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.
25111   * @return {MultiPoint} Interior points as XYM coordinates, where M is
25112   * the length of the horizontal intersection that the point belongs to.
25113   * @api
25114   */
25115  getInteriorPoints() {
25116    return new rc(this.getFlatInteriorPoints().slice(), "XYM");
25117  }
25118  /**
25119   * @return {Array<number>} Oriented flat coordinates.
25120   */
25121  getOrientedFlatCoordinates() {
25122    if (this.orientedRevision_ != this.getRevision()) {
25123      const t = this.flatCoordinates;
25124      tM(t, 0, this.endss_, this.stride) ? this.orientedFlatCoordinates_ = t : (this.orientedFlatCoordinates_ = t.slice(), this.orientedFlatCoordinates_.length = Ru(
25125        this.orientedFlatCoordinates_,
25126        0,
25127        this.endss_,
25128        this.stride
25129      )), this.orientedRevision_ = this.getRevision();
25130    }
25131    return this.orientedFlatCoordinates_;
25132  }
25133  /**
25134   * @param {number} squaredTolerance Squared tolerance.
25135   * @return {MultiPolygon} Simplified MultiPolygon.
25136   * @protected
25137   */
25138  getSimplifiedGeometryInternal(t) {
25139    const i = [], s = [];
25140    return i.length = YE(
25141      this.flatCoordinates,
25142      0,
25143      this.endss_,
25144      this.stride,
25145      Math.sqrt(t),
25146      i,
25147      0,
25148      s
25149    ), new $o(i, "XY", s);
25150  }
25151  /**
25152   * Return the polygon at the specified index.
25153   * @param {number} index Index.
25154   * @return {Polygon} Polygon.
25155   * @api
25156   */
25157  getPolygon(t) {
25158    if (t < 0 || this.endss_.length <= t)
25159      return null;
25160    let i;
25161    if (t === 0)
25162      i = 0;
25163    else {
25164      const r = this.endss_[t - 1];
25165      i = r[r.length - 1];
25166    }
25167    const s = this.endss_[t].slice(), n = s[s.length - 1];
25168    if (i !== 0)
25169      for (let r = 0, o = s.length; r < o; ++r)
25170        s[r] -= i;
25171    return new bn(
25172      this.flatCoordinates.slice(i, n),
25173      this.layout,
25174      s
25175    );
25176  }
25177  /**
25178   * Return the polygons of this multipolygon.
25179   * @return {Array<Polygon>} Polygons.
25180   * @api
25181   */
25182  getPolygons() {
25183    const t = this.layout, i = this.flatCoordinates, s = this.endss_, n = [];
25184    let r = 0;
25185    for (let o = 0, a = s.length; o < a; ++o) {
25186      const l = s[o].slice(), h = l[l.length - 1];
25187      if (r !== 0)
25188        for (let u = 0, d = l.length; u < d; ++u)
25189          l[u] -= r;
25190      const c = new bn(
25191        i.slice(r, h),
25192        t,
25193        l
25194      );
25195      n.push(c), r = h;
25196    }
25197    return n;
25198  }
25199  /**
25200   * Get the type of this geometry.
25201   * @return {import("./Geometry.js").Type} Geometry type.
25202   * @api
25203   */
25204  getType() {
25205    return "MultiPolygon";
25206  }
25207  /**
25208   * Test if the geometry and the passed extent intersect.
25209   * @param {import("../extent.js").Extent} extent Extent.
25210   * @return {boolean} `true` if the geometry and the extent intersect.
25211   * @api
25212   */
25213  intersectsExtent(t) {
25214    return JE(
25215      this.getOrientedFlatCoordinates(),
25216      0,
25217      this.endss_,
25218      this.stride,
25219      t
25220    );
25221  }
25222  /**
25223   * Set the coordinates of the multipolygon.
25224   * @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
25225   * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
25226   * @api
25227   */
25228  setCoordinates(t, i) {
25229    this.setLayout(i, t, 3), this.flatCoordinates || (this.flatCoordinates = []);
25230    const s = UE(
25231      this.flatCoordinates,
25232      0,
25233      t,
25234      this.stride,
25235      this.endss_
25236    );
25237    if (s.length === 0)
25238      this.flatCoordinates.length = 0;
25239    else {
25240      const n = s[s.length - 1];
25241      this.flatCoordinates.length = n.length === 0 ? 0 : n[n.length - 1];
25242    }
25243    this.changed();
25244  }
25245}
25246const oc = $o, io = {
25247  /**
25248   * Triggered upon feature draw start
25249   * @event DrawEvent#drawstart
25250   * @api
25251   */
25252  DRAWSTART: "drawstart",
25253  /**
25254   * Triggered upon feature draw end
25255   * @event DrawEvent#drawend
25256   * @api
25257   */
25258  DRAWEND: "drawend",
25259  /**
25260   * Triggered upon feature draw abortion
25261   * @event DrawEvent#drawabort
25262   * @api
25263   */
25264  DRAWABORT: "drawabort"
25265};
25266class so extends Ae {
25267  /**
25268   * @param {DrawEventType} type Type.
25269   * @param {Feature} feature The feature drawn.
25270   */
25271  constructor(t, i) {
25272    super(t), this.feature = i;
25273  }
25274}
25275function Jb(e, t) {
25276  const i = [];
25277  for (let s = 0; s < t.length; ++s) {
25278    const r = t[s].getGeometry();
25279    Xg(e, r, i);
25280  }
25281  return i;
25282}
25283function no(e, t) {
25284  return gi(e[0], e[1], t[0], t[1]);
25285}
25286function tn(e, t) {
25287  const i = e.length;
25288  return t < 0 ? e[t + i] : t >= i ? e[t - i] : e[t];
25289}
25290function ro(e, t, i) {
25291  let s, n;
25292  t < i ? (s = t, n = i) : (s = i, n = t);
25293  const r = Math.ceil(s), o = Math.floor(n);
25294  if (r > o) {
25295    const l = en(e, s), h = en(e, n);
25296    return no(l, h);
25297  }
25298  let a = 0;
25299  if (s < r) {
25300    const l = en(e, s), h = tn(e, r);
25301    a += no(l, h);
25302  }
25303  if (o < n) {
25304    const l = tn(e, o), h = en(e, n);
25305    a += no(l, h);
25306  }
25307  for (let l = r; l < o - 1; ++l) {
25308    const h = tn(e, l), c = tn(e, l + 1);
25309    a += no(h, c);
25310  }
25311  return a;
25312}
25313function Xg(e, t, i) {
25314  if (t instanceof ys) {
25315    oo(e, t.getCoordinates(), !1, i);
25316    return;
25317  }
25318  if (t instanceof sc) {
25319    const s = t.getCoordinates();
25320    for (let n = 0, r = s.length; n < r; ++n)
25321      oo(e, s[n], !1, i);
25322    return;
25323  }
25324  if (t instanceof bn) {
25325    const s = t.getCoordinates();
25326    for (let n = 0, r = s.length; n < r; ++n)
25327      oo(e, s[n], !0, i);
25328    return;
25329  }
25330  if (t instanceof oc) {
25331    const s = t.getCoordinates();
25332    for (let n = 0, r = s.length; n < r; ++n) {
25333      const o = s[n];
25334      for (let a = 0, l = o.length; a < l; ++a)
25335        oo(e, o[a], !0, i);
25336    }
25337    return;
25338  }
25339  if (t instanceof Ug) {
25340    const s = t.getGeometries();
25341    for (let n = 0; n < s.length; ++n)
25342      Xg(e, s[n], i);
25343    return;
25344  }
25345}
25346const qa = { index: -1, endIndex: NaN };
25347function Qb(e, t, i, s) {
25348  const n = e[0], r = e[1];
25349  let o = 1 / 0, a = -1, l = NaN;
25350  for (let u = 0; u < t.targets.length; ++u) {
25351    const d = t.targets[u], f = d.coordinates;
25352    let g = 1 / 0, _;
25353    for (let m = 0; m < f.length - 1; ++m) {
25354      const p = f[m], y = f[m + 1], v = $g(n, r, p, y);
25355      v.squaredDistance < g && (g = v.squaredDistance, _ = m + v.along);
25356    }
25357    g < o && (o = g, d.ring && t.targetIndex === u && (d.endIndex > d.startIndex ? _ < d.startIndex && (_ += f.length) : d.endIndex < d.startIndex && _ > d.startIndex && (_ -= f.length)), l = _, a = u);
25358  }
25359  const h = t.targets[a];
25360  let c = h.ring;
25361  if (t.targetIndex === a && c) {
25362    const u = en(
25363      h.coordinates,
25364      l
25365    ), d = i.getPixelFromCoordinate(u);
25366    bo(d, t.startPx) > s && (c = !1);
25367  }
25368  if (c) {
25369    const u = h.coordinates, d = u.length, f = h.startIndex, g = l;
25370    if (f < g) {
25371      const _ = ro(
25372        u,
25373        f,
25374        g
25375      );
25376      ro(
25377        u,
25378        f,
25379        g - d
25380      ) < _ && (l -= d);
25381    } else {
25382      const _ = ro(
25383        u,
25384        f,
25385        g
25386      );
25387      ro(
25388        u,
25389        f,
25390        g + d
25391      ) < _ && (l += d);
25392    }
25393  }
25394  return qa.index = a, qa.endIndex = l, qa;
25395}
25396function oo(e, t, i, s) {
25397  const n = e[0], r = e[1];
25398  for (let o = 0, a = t.length - 1; o < a; ++o) {
25399    const l = t[o], h = t[o + 1], c = $g(n, r, l, h);
25400    if (c.squaredDistance === 0) {
25401      const u = o + c.along;
25402      s.push({
25403        coordinates: t,
25404        ring: i,
25405        startIndex: u,
25406        endIndex: u
25407      });
25408      return;
25409    }
25410  }
25411}
25412const Va = { along: 0, squaredDistance: 0 };
25413function $g(e, t, i, s) {
25414  const n = i[0], r = i[1], o = s[0], a = s[1], l = o - n, h = a - r;
25415  let c = 0, u = n, d = r;
25416  return (l !== 0 || h !== 0) && (c = Ot(((e - n) * l + (t - r) * h) / (l * l + h * h), 0, 1), u += l * c, d += h * c), Va.along = c, Va.squaredDistance = Ir(gi(e, t, u, d), 10), Va;
25417}
25418function en(e, t) {
25419  const i = e.length;
25420  let s = Math.floor(t);
25421  const n = t - s;
25422  s >= i ? s -= i : s < 0 && (s += i);
25423  let r = s + 1;
25424  r >= i && (r -= i);
25425  const o = e[s], a = o[0], l = o[1], h = e[r], c = h[0] - a, u = h[1] - l;
25426  return [a + c * n, l + u * n];
25427}
25428class tw extends is {
25429  /**
25430   * @param {Options} options Options.
25431   */
25432  constructor(t) {
25433    const i = (
25434      /** @type {import("./Pointer.js").Options} */
25435      t
25436    );
25437    i.stopDown || (i.stopDown = As), super(i), this.on, this.once, this.un, this.shouldHandle_ = !1, this.downPx_ = null, this.downTimeout_, this.lastDragTime_, this.pointerType_, this.freehand_ = !1, this.source_ = t.source ? t.source : null, this.features_ = t.features ? t.features : null, this.snapTolerance_ = t.snapTolerance ? t.snapTolerance : 12, this.type_ = /** @type {import("../geom/Geometry.js").Type} */
25438    t.type, this.mode_ = iw(this.type_), this.stopClick_ = !!t.stopClick, this.minPoints_ = t.minPoints ? t.minPoints : this.mode_ === "Polygon" ? 3 : 2, this.maxPoints_ = this.mode_ === "Circle" ? 2 : t.maxPoints ? t.maxPoints : 1 / 0, this.finishCondition_ = t.finishCondition ? t.finishCondition : Ss, this.geometryLayout_ = t.geometryLayout ? t.geometryLayout : "XY";
25439    let s = t.geometryFunction;
25440    if (!s) {
25441      const n = this.mode_;
25442      if (n === "Circle")
25443        s = function(r, o, a) {
25444          const l = o || new Hb([NaN, NaN]), h = Pt(r[0]), c = _i(
25445            h,
25446            Pt(r[r.length - 1])
25447          );
25448          return l.setCenterAndRadius(
25449            h,
25450            Math.sqrt(c),
25451            this.geometryLayout_
25452          ), l;
25453        };
25454      else {
25455        let r;
25456        n === "Point" ? r = yi : n === "LineString" ? r = ys : n === "Polygon" && (r = bn), s = function(o, a, l) {
25457          return a ? n === "Polygon" ? o[0].length ? a.setCoordinates(
25458            [o[0].concat([o[0][0]])],
25459            this.geometryLayout_
25460          ) : a.setCoordinates([], this.geometryLayout_) : a.setCoordinates(o, this.geometryLayout_) : a = new r(o, this.geometryLayout_), a;
25461        };
25462      }
25463    }
25464    this.geometryFunction_ = s, this.dragVertexDelay_ = t.dragVertexDelay !== void 0 ? t.dragVertexDelay : 500, this.finishCoordinate_ = null, this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchCoords_ = null, this.sketchLine_ = null, this.sketchLineCoords_ = null, this.squaredClickTolerance_ = t.clickTolerance ? t.clickTolerance * t.clickTolerance : 36, this.overlay_ = new xa({
25465      source: new va({
25466        useSpatialIndex: !1,
25467        wrapX: t.wrapX ? t.wrapX : !1
25468      }),
25469      style: t.style ? t.style : ew(),
25470      updateWhileInteracting: !0
25471    }), this.geometryName_ = t.geometryName, this.condition_ = t.condition ? t.condition : $h, this.freehandCondition_, t.freehand ? this.freehandCondition_ = jo : this.freehandCondition_ = t.freehandCondition ? t.freehandCondition : yg, this.traceCondition_, this.setTrace(t.trace || !1), this.traceState_ = { active: !1 }
25471, this.traceSource_ = t.traceSource || t.source || null, this.addChangeListener(Ol.ACTIVE, this.updateState_);
25472  }
25473  /**
25474   * Toggle tracing mode or set a tracing condition.
25475   *
25476   * @param {boolean|import("../events/condition.js").Condition} trace A boolean to toggle tracing mode or an event
25477   *     condition that will be checked when a feature is clicked to determine if tracing should be active.
25478   */
25479  setTrace(t) {
25480    let i;
25481    t ? t === !0 ? i = jo : i = t : i = KM, this.traceCondition_ = i;
25482  }
25483  /**
25484   * Remove the interaction from its current map and attach it to the new map.
25485   * Subclasses may set up event handlers to get notified about changes to
25486   * the map here.
25487   * @param {import("../Map.js").default} map Map.
25488   */
25489  setMap(t) {
25490    super.setMap(t), this.updateState_();
25491  }
25492  /**
25493   * Get the overlay layer that this interaction renders sketch features to.
25494   * @return {VectorLayer} Overlay layer.
25495   * @api
25496   */
25497  getOverlay() {
25498    return this.overlay_;
25499  }
25500  /**
25501   * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.
25502   * @param {import("../MapBrowserEvent.js").default} event Map browser event.
25503   * @return {boolean} `false` to stop event propagation.
25504   * @api
25505   */
25506  handleEvent(t) {
25507    t.originalEvent.type === et.CONTEXTMENU && t.originalEvent.preventDefault(), this.freehand_ = this.mode_ !== "Point" && this.freehandCondition_(t);
25508    let i = t.type === dt.POINTERMOVE, s = !0;
25509    return !this.freehand_ && this.lastDragTime_ && t.type === dt.POINTERDRAG && (Date.now() - this.lastDragTime_ >= this.dragVertexDelay_ ? (this.downPx_ = t.pixel, this.shouldHandle_ = !this.freehand_, i = !0) : this.lastDragTime_ = void 0, this.shouldHandle_ && this.downTimeout_ !== void 0 && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0)), this.freehand_ && t.type === dt.POINTERDRAG && this.sketchFeature_ !== null ? (this.addToDrawing_(t.coordinate), s = !1) : this.freehand_ && t.type === dt.POINTERDOWN ? s = !1 : i && this.getPointerCount() < 2 ? (s = t.type === dt.POINTERMOVE, s && this.freehand_ ? (this.handlePointerMove_(t), this.shouldHandle_ && t.originalEvent.preventDefault()) : (t.originalEvent.pointerType === "mouse" || t.type === dt.POINTERDRAG && this.downTimeout_ === void 0) && this.handlePointerMove_(t)) : t.type === dt.DBLCLICK && (s = !1), super.handleEvent(t) && s;
25510  }
25511  /**
25512   * Handle pointer down events.
25513   * @param {import("../MapBrowserEvent.js").default} event Event.
25514   * @return {boolean} If the event was consumed.
25515   */
25516  handleDownEvent(t) {
25517    return this.shouldHandle_ = !this.freehand_, this.freehand_ ? (this.downPx_ = t.pixel, this.finishCoordinate_ || this.startDrawing_(t.coordinate), !0) : this.condition_(t) ? (this.lastDragTime_ = Date.now(), this.downTimeout_ = setTimeout(() => {
25518      this.handlePointerMove_(
25519        new ui(
25520          dt.POINTERMOVE,
25521          t.map,
25522          t.originalEvent,
25523          !1,
25524          t.frameState
25525        )
25526      );
25527    }, this.dragVertexDelay_), this.downPx_ = t.pixel, !0) : (this.lastDragTime_ = void 0, !1);
25528  }
25529  /**
25530   * @private
25531   */
25532  deactivateTrace_() {
25533    this.traceState_ = { active: !1 };
25534  }
25535  /**
25536   * Activate or deactivate trace state based on a browser event.
25537   * @param {import("../MapBrowserEvent.js").default} event Event.
25538   * @private
25539   */
25540  toggleTraceState_(t) {
25541    if (!this.traceSource_ || !this.traceCondition_(t))
25542      return;
25543    if (this.traceState_.active) {
25544      this.deactivateTrace_();
25545      return;
25546    }
25547    const i = this.getMap(), s = i.getCoordinateFromPixel([
25548      t.pixel[0] - this.snapTolerance_,
25549      t.pixel[1] + this.snapTolerance_
25550    ]), n = i.getCoordinateFromPixel([
25551      t.pixel[0] + this.snapTolerance_,
25552      t.pixel[1] - this.snapTolerance_
25553    ]), r = ce([s, n]), o = this.traceSource_.getFeaturesInExtent(r);
25554    if (o.length === 0)
25555      return;
25556    const a = Jb(t.coordinate, o);
25557    a.length && (this.traceState_ = {
25558      active: !0,
25559      startPx: t.pixel.slice(),
25560      targets: a,
25561      targetIndex: -1
25562    });
25563  }
25564  /**
25565   * @param {TraceTarget} target The trace target.
25566   * @param {number} endIndex The new end index of the trace.
25567   * @private
25568   */
25569  addOrRemoveTracedCoordinates_(t, i) {
25570    const s = t.startIndex <= t.endIndex, n = t.startIndex <= i;
25571    s === n ? s && i > t.endIndex || !s && i < t.endIndex ? this.addTracedCoordinates_(t, t.endIndex, i) : (s && i < t.endIndex || !s && i > t.endIndex) && this.removeTracedCoordinates_(i, t.endIndex) : (this.removeTracedCoordinates_(t.startIndex, t.endIndex), this.addTracedCoordinates_(t, t.startIndex, i));
25572  }
25573  /**
25574   * @param {number} fromIndex The start index.
25575   * @param {number} toIndex The end index.
25576   * @private
25577   */
25578  removeTracedCoordinates_(t, i) {
25579    if (t === i)
25580      return;
25581    let s = 0;
25582    if (t < i) {
25583      const n = Math.ceil(t);
25584      let r = Math.floor(i);
25585      r === i && (r -= 1), s = r - n + 1;
25586    } else {
25587      const n = Math.floor(t);
25588      let r = Math.ceil(i);
25589      r === i && (r += 1), s = n - r + 1;
25590    }
25591    s > 0 && this.removeLastPoints_(s);
25592  }
25593  /**
25594   * @param {TraceTarget} target The trace target.
25595   * @param {number} fromIndex The start index.
25596   * @param {number} toIndex The end index.
25597   * @private
25598   */
25599  addTracedCoordinates_(t, i, s) {
25600    if (i === s)
25601      return;
25602    const n = [];
25603    if (i < s) {
25604      const r = Math.ceil(i);
25605      let o = Math.floor(s);
25606      o === s && (o -= 1);
25607      for (let a = r; a <= o; ++a)
25608        n.push(tn(t.coordinates, a));
25609    } else {
25610      const r = Math.floor(i);
25611      let o = Math.ceil(s);
25612      o === s && (o += 1);
25613      for (let a = r; a >= o; --a)
25614        n.push(tn(t.coordinates, a));
25615    }
25616    n.length && this.appendCoordinates(n);
25617  }
25618  /**
25619   * Update the trace.
25620   * @param {import("../MapBrowserEvent.js").default} event Event.
25621   * @private
25622   */
25623  updateTrace_(t) {
25624    const i = this.traceState_;
25625    if (!i.active || i.targetIndex === -1 && bo(i.startPx, t.pixel) < this.snapTolerance_)
25626      return;
25627    const s = Qb(
25628      t.coordinate,
25629      i,
25630      this.getMap(),
25631      this.snapTolerance_
25632    );
25633    if (i.targetIndex !== s.index) {
25634      if (i.targetIndex !== -1) {
25635        const l = i.targets[i.targetIndex];
25636        this.removeTracedCoordinates_(l.startIndex, l.endIndex);
25637      }
25638      const a = i.targets[s.index];
25639      this.addTracedCoordinates_(
25640        a,
25641        a.startIndex,
25642        s.endIndex
25643      );
25644    } else {
25645      const a = i.targets[i.targetIndex];
25646      this.addOrRemoveTracedCoordinates_(a, s.endIndex);
25647    }
25648    i.targetIndex = s.index;
25649    const n = i.targets[i.targetIndex];
25650    n.endIndex = s.endIndex;
25651    const r = en(
25652      n.coordinates,
25653      n.endIndex
25654    ), o = this.getMap().getPixelFromCoordinate(r);
25655    t.coordinate = r, t.pixel = [Math.round(o[0]), Math.round(o[1])];
25656  }
25657  /**
25658   * Handle pointer up events.
25659   * @param {import("../MapBrowserEvent.js").default} event Event.
25660   * @return {boolean} If the event was consumed.
25661   */
25662  handleUpEvent(t) {
25663    let i = !0;
25664    if (this.getPointerCount() === 0) {
25665      this.downTimeout_ && (clearTimeout(this.downTimeout_), this.downTimeout_ = void 0), this.handlePointerMove_(t);
25666      const s = this.traceState_.active;
25667      if (this.toggleTraceState_(t), this.shouldHandle_) {
25668        const n = !this.finishCoordinate_;
25669        n && this.startDrawing_(t.coordinate), !n && this.freehand_ ? this.finishDrawing() : !this.freehand_ && (!n || this.mode_ === "Point") && (this.atFinish_(t.pixel, s) ? this.finishCondition_(t) && this.finishDrawing() : this.addToDrawing_(t.coordinate)), i = !1;
25670      } else
25671        this.freehand_ && this.abortDrawing();
25672    }
25673    return !i && this.stopClick_ && t.preventDefault(), i;
25674  }
25675  /**
25676   * Handle move events.
25677   * @param {import("../MapBrowserEvent.js").default} event A move event.
25678   * @private
25679   */
25680  handlePointerMove_(t) {
25681    if (this.pointerType_ = t.originalEvent.pointerType, this.downPx_ && (!this.freehand_ && this.shouldHandle_ || this.freehand_ && !this.shouldHandle_)) {
25682      const i = this.downPx_, s = t.pixel, n = i[0] - s[0], r = i[
256821] - s[1], o = n * n + r * r;
25683      if (this.shouldHandle_ = this.freehand_ ? o > this.squaredClickTolerance_ : o <= this.squaredClickTolerance_, !this.shouldHandle_)
25684        return;
25685    }
25686    if (!this.finishCoordinate_) {
25687      this.createOrUpdateSketchPoint_(t.coordinate.slice());
25688      return;
25689    }
25690    this.updateTrace_(t), this.modifyDrawing_(t.coordinate);
25691  }
25692  /**
25693   * Determine if an event is within the snapping tolerance of the start coord.
25694   * @param {import("../pixel.js").Pixel} pixel Pixel.
25695   * @param {boolean} [tracing] Drawing in trace mode (only stop if at the starting point).
25696   * @return {boolean} The event is within the snapping tolerance of the start.
25697   * @private
25698   */
25699  atFinish_(t, i) {
25700    let s = !1;
25701    if (this.sketchFeature_) {
25702      let n = !1, r = [this.finishCoordinate_];
25703      const o = this.mode_;
25704      if (o === "Point")
25705        s = !0;
25706      else if (o === "Circle")
25707        s = this.sketchCoords_.length === 2;
25708      else if (o === "LineString")
25709        n = !i && this.sketchCoords_.length > this.minPoints_;
25710      else if (o === "Polygon") {
25711        const a = (
25712          /** @type {PolyCoordType} */
25713          this.sketchCoords_
25714        );
25715        n = a[0].length > this.minPoints_, r = [
25716          a[0][0],
25717          a[0][a[0].length - 2]
25718        ], i ? r = [a[0][0]] : r = [
25719          a[0][0],
25720          a[0][a[0].length - 2]
25721        ];
25722      }
25723      if (n) {
25724        const a = this.getMap();
25725        for (let l = 0, h = r.length; l < h; l++) {
25726          const c = r[l], u = a.getPixelFromCoordinate(c), d = t[0] - u[0], f = t[1] - u[1], g = this.freehand_ ? 1 : this.snapTolerance_;
25727          if (s = Math.sqrt(d * d + f * f) <= g, s) {
25728            this.finishCoordinate_ = c;
25729            break;
25730          }
25731        }
25732      }
25733    }
25734    return s;
25735  }
25736  /**
25737   * @param {import("../coordinate").Coordinate} coordinates Coordinate.
25738   * @private
25739   */
25740  createOrUpdateSketchPoint_(t) {
25741    this.sketchPoint_ ? this.sketchPoint_.getGeometry().setCoordinates(t) : (this.sketchPoint_ = new Di(new yi(t)), this.updateSketchFeatures_());
25742  }
25743  /**
25744   * @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
25745   * @private
25746   */
25747  createOrUpdateCustomSketchLine_(t) {
25748    this.sketchLine_ || (this.sketchLine_ = new Di());
25749    const i = t.getLinearRing(0);
25750    let s = this.sketchLine_.getGeometry();
25751    s ? (s.setFlatCoordinates(
25752      i.getLayout(),
25753      i.getFlatCoordinates()
25754    ), s.changed()) : (s = new ys(
25755      i.getFlatCoordinates(),
25756      i.getLayout()
25757    ), this.sketchLine_.setGeometry(s));
25758  }
25759  /**
25760   * Start the drawing.
25761   * @param {import("../coordinate.js").Coordinate} start Start coordinate.
25762   * @private
25763   */
25764  startDrawing_(t) {
25765    const i = this.getMap().getView().getProjection(), s = Fo(this.geometryLayout_);
25766    for (; t.length < s; )
25767      t.push(0);
25768    this.finishCoordinate_ = t, this.mode_ === "Point" ? this.sketchCoords_ = t.slice() : this.mode_ === "Polygon" ? (this.sketchCoords_ = [[t.slice(), t.slice()]], this.sketchLineCoords_ = this.sketchCoords_[0]) : this.sketchCoords_ = [t.slice(), t.slice()], this.sketchLineCoords_ && (this.sketchLine_ = new Di(new ys(this.sketchLineCoords_)));
25769    const n = this.geometryFunction_(
25770      this.sketchCoords_,
25771      void 0,
25772      i
25773    );
25774    this.sketchFeature_ = new Di(), this.geometryName_ && this.sketchFeature_.setGeometryName(this.geometryName_), this.sketchFeature_.setGeometry(n), this.updateSketchFeatures_(), this.dispatchEvent(
25775      new so(io.DRAWSTART, this.sketchFeature_)
25776    );
25777  }
25778  /**
25779   * Modify the drawing.
25780   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
25781   * @private
25782   */
25783  modifyDrawing_(t) {
25784    const i = this.getMap(), s = this.sketchFeature_.getGeometry(), n = i.getView().getProjection(), r = Fo(this.geometryLayout_);
25785    let o, a;
25786    for (; t.length < r; )
25787      t.push(0);
25788    this.mode_ === "Point" ? a = this.sketchCoords_ : this.mode_ === "Polygon" ? (o = /** @type {PolyCoordType} */
25789    this.sketchCoords_[0], a = o[o.length - 1], this.atFinish_(i.getPixelFromCoordinate(t)) && (t = this.finishCoordinate_.slice())) : (o = this.sketchCoords_, a = o[o.length - 1]), a[0] = t[0], a[1] = t[1], this.geometryFunction_(
25790      /** @type {!LineCoordType} */
25791      this.sketchCoords_,
25792      s,
25793      n
25794    ), this.sketchPoint_ && this.sketchPoint_.getGeometry().setCoordinates(t), s.getType() === "Polygon" && this.mode_ !== "Polygon" ? this.createOrUpdateCustomSketchLine_(
25795      /** @type {Polygon} */
25796      s
25797    ) : this.sketchLineCoords_ && this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_), this.updateSketchFeatures_();
25798  }
25799  /**
25800   * Add a new coordinate to the drawing.
25801   * @param {!PointCoordType} coordinate Coordinate
25802   * @private
25803   */
25804  addToDrawing_(t) {
25805    const i = this.sketchFeature_.getGeometry(), s = this.getMap().getView().getProjection();
25806    let n, r;
25807    const o = this.mode_;
25808    o === "LineString" || o === "Circle" ? (this.finishCoordinate_ = t.slice(), r = /** @type {LineCoordType} */
25809    this.sketchCoords_, r.length >= this.maxPoints_ && (this.freehand_ ? r.pop() : n = !0), r.push(t.slice()), this.geometryFunction_(r, i, s)) : o === "Polygon" && (r = /** @type {PolyCoordType} */
25810    this.sketchCoords_[0], r.length >= this.maxPoints_ && (this.freehand_ ? r.pop() : n = !0), r.push(t.slice()), n && (this.finishCoordinate_ = r[0]), this.geometryFunction_(this.sketchCoords_, i, s)), this.createOrUpdateSketchPoint_(t.slice()), this.updateSketchFeatures_(), n && this.finishDrawing();
25811  }
25812  /**
25813   * @param {number} n The number of points to remove.
25814   */
25815  removeLastPoints_(t) {
25816    if (!this.sketchFeature_)
25817      return;
25818    const i = this.sketchFeature_.getGeometry(), s = this.getMap().getView().getProjection(), n = this.mode_;
25819    for (let r = 0; r < t; ++r) {
25820      let o;
25821      if (n === "LineString" || n === "Circle") {
25822        if (o = /** @type {LineCoordType} */
25823        this.sketchCoords_, o.splice(-2, 1), o.length >= 2) {
25824          this.finishCoordinate_ = o[o.length - 2].slice();
25825          const a = this.finishCoordinate_.slice();
25826          o[o.length - 1] = a, this.createOrUpdateSketchPoint_(a);
25827        }
25828        this.geometryFunction_(o, i, s), i.getType() === "Polygon" && this.sketchLine_ && this.createOrUpdateCustomSketchLine_(
25829          /** @type {Polygon} */
25830          i
25831        );
25832      } else if (n === "Polygon") {
25833        o = /** @type {PolyCoordType} */
25834        this.sketchCoords_[0], o.splice(-2, 1);
25835        const a = this.sketchLine_.getGeometry();
25836        if (o.length >= 2) {
25837          const l = o[o.length - 2].slice();
25838          o[o.length - 1] = l, this.createOrUpdateSketchPoint_(l);
25839        }
25840        a.setCoordinates(o), this.geometryFunction_(this.sketchCoords_, i, s);
25841      }
25842      if (o.length === 1) {
25843        this.abortDrawing();
25844        break;
25845      }
25846    }
25847    this.updateSketchFeatures_();
25848  }
25849  /**
25850   * Remove last point of the feature currently being drawn. Does not do anything when
25851   * drawing POINT or MULTI_POINT geometries.
25852   * @api
25853   */
25854  removeLastPoint() {
25855    this.removeLastPoints_(1);
25856  }
25857  /**
25858   * Stop drawing and add the sketch feature to the target layer.
25859   * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
25860   * dispatched before inserting the feature.
25861   * @api
25862   */
25863  finishDrawing() {
25864    const t = this.abortDrawing_();
25865    if (!t)
25866      return;
25867    let i = this.sketchCoords_;
25868    const s = t.getGeometry(), n = this.getMap().getView().getProjection();
25869    this.mode_ === "LineString" ? (i.pop(), this.geometryFunction_(i, s, n)) : this.mode_ === "Polygon" && (i[0].pop(), this.geometryFunction_(i, s, n), i = s.getCoordinates()), this.type_ === "MultiPoint" ? t.setGeometry(
25870      new rc([
25871        /** @type {PointCoordType} */
25872        i
25873      ])
25874    ) : this.type_ === "MultiLineString" ? t.setGeometry(
25875      new sc([
25876        /** @type {LineCoordType} */
25877        i
25878      ])
25879    ) : this.type_ === "MultiPolygon" && t.setGeometry(
25880      new oc([
25881        /** @type {PolyCoordType} */
25882        i
25883      ])
25884    ), this.dispatchEvent(new so(io.DRAWEND, t)), this.features_ && this.features_.push(t), this.source_ && this.source_.addFeature(t);
25885  }
25886  /**
25887   * Stop drawing without adding the sketch feature to the target layer.
25888   * @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The sketch feature (or null if none).
25889   * @private
25890   */
25891  abortDrawing_() {
25892    this.finishCoordinate_ = null;
25893    const t = this.sketchFeature_;
25894    return this.sketchFeature_ = null, this.sketchPoint_ = null, this.sketchLine_ = null, this.overlay_.getSource().clear(!0), this.deactivateTrace_(), t;
25895  }
25896  /**
25897   * Stop drawing without adding the sketch feature to the target layer.
25898   * @api
25899   */
25900  abortDrawing() {
25901    const t = this.abortDrawing_();
25902    t && this.dispatchEvent(new so(io.DRAWABORT, t));
25903  }
25904  /**
25905   * Append coordinates to the end of the geometry that is currently being drawn.
25906   * This can be used when drawing LineStrings or Polygons. Coordinates will
25907   * either be appended to the current LineString or the outer ring of the current
25908   * Polygon. If no geometry is being drawn, a new one will be created.
25909   * @param {!LineCoordType}
25909 coordinates Linear coordinates to be appended to
25910   * the coordinate array.
25911   * @api
25912   */
25913  appendCoordinates(t) {
25914    const i = this.mode_, s = !this.sketchFeature_;
25915    s && this.startDrawing_(t[0]);
25916    let n;
25917    if (i === "LineString" || i === "Circle")
25918      n = /** @type {LineCoordType} */
25919      this.sketchCoords_;
25920    else if (i === "Polygon")
25921      n = this.sketchCoords_ && this.sketchCoords_.length ? (
25922        /** @type {PolyCoordType} */
25923        this.sketchCoords_[0]
25924      ) : [];
25925    else
25926      return;
25927    s && n.shift(), n.pop();
25928    for (let o = 0; o < t.length; o++)
25929      this.addToDrawing_(t[o]);
25930    const r = t[t.length - 1];
25931    this.addToDrawing_(r), this.modifyDrawing_(r);
25932  }
25933  /**
25934   * Initiate draw mode by starting from an existing geometry which will
25935   * receive new additional points. This only works on features with
25936   * `LineString` geometries, where the interaction will extend lines by adding
25937   * points to the end of the coordinates array.
25938   * This will change the original feature, instead of drawing a copy.
25939   *
25940   * The function will dispatch a `drawstart` event.
25941   *
25942   * @param {!Feature<LineString>} feature Feature to be extended.
25943   * @api
25944   */
25945  extend(t) {
25946    const s = t.getGeometry();
25947    this.sketchFeature_ = t, this.sketchCoords_ = s.getCoordinates();
25948    const n = this.sketchCoords_[this.sketchCoords_.length - 1];
25949    this.finishCoordinate_ = n.slice(), this.sketchCoords_.push(n.slice()), this.sketchPoint_ = new Di(new yi(n)), this.updateSketchFeatures_(), this.dispatchEvent(
25950      new so(io.DRAWSTART, this.sketchFeature_)
25951    );
25952  }
25953  /**
25954   * Redraw the sketch features.
25955   * @private
25956   */
25957  updateSketchFeatures_() {
25958    const t = [];
25959    this.sketchFeature_ && t.push(this.sketchFeature_), this.sketchLine_ && t.push(this.sketchLine_), this.sketchPoint_ && t.push(this.sketchPoint_);
25960    const i = this.overlay_.getSource();
25961    i.clear(!0), i.addFeatures(t);
25962  }
25963  /**
25964   * @private
25965   */
25966  updateState_() {
25967    const t = this.getMap(), i = this.getActive();
25968    (!t || !i) && this.abortDrawing(), this.overlay_.setMap(i ? t : null);
25969  }
25970}
25971function ew() {
25972  const e = Rg();
25973  return function(t, i) {
25974    return e[t.getGeometry().getType()];
25975  };
25976}
25977function iw(e) {
25978  switch (e) {
25979    case "Point":
25980    case "MultiPoint":
25981      return "Point";
25982    case "LineString":
25983    case "MultiLineString":
25984      return "LineString";
25985    case "Polygon":
25986    case "MultiPolygon":
25987      return "Polygon";
25988    case "Circle":
25989      return "Circle";
25990    default:
25991      throw new Error("Invalid type: " + e);
25992  }
25993}
25994const sw = tw;
25995function rd(e) {
25996  return (
25997    /** @type {import("../source/Vector.js").VectorSourceEvent} */
25998    e.feature ? (
25999      /** @type {import("../source/Vector.js").VectorSourceEvent} */
26000      e.feature
26001    ) : (
26002      /** @type {import("../Collection.js").CollectionEvent<import("../Feature.js").default>} */
26003      e.element ? (
26004        /** @type {import("../Collection.js").CollectionEvent<import("../Feature.js").default>} */
26005        e.element
26006      ) : null
26007    )
26008  );
26009}
26010const Ha = [];
26011class nw extends is {
26012  /**
26013   * @param {Options} [options] Options.
26014   */
26015  constructor(t) {
26016    t = t || {};
26017    const i = (
26018      /** @type {import("./Pointer.js").Options} */
26019      t
26020    );
26021    i.handleDownEvent || (i.handleDownEvent = Ss), i.stopDown || (i.stopDown = As), super(i), this.source_ = t.source ? t.source : null, this.vertex_ = t.vertex !== void 0 ? t.vertex : !0, this.edge_ = t.edge !== void 0 ? t.edge : !0, this.features_ = t.features ? t.features : null, this.featuresListenerKeys_ = [], this.featureChangeListenerKeys_ = {}, this.indexedFeaturesExtents_ = {}, this.pendingFeatures_ = {}, this.pixelTolerance_ = t.pixelTolerance !== void 0 ? t.pixelTolerance : 10, this.rBush_ = new Bo(), this.GEOMETRY_SEGMENTERS_ = {
26022      Point: this.segmentPointGeometry_.bind(this),
26023      LineString: this.segmentLineStringGeometry_.bind(this),
26024      LinearRing: this.segmentLineStringGeometry_.bind(this),
26025      Polygon: this.segmentPolygonGeometry_.bind(this),
26026      MultiPoint: this.segmentMultiPointGeometry_.bind(this),
26027      MultiLineString: this.segmentMultiLineStringGeometry_.bind(this),
26028      MultiPolygon: this.segmentMultiPolygonGeometry_.bind(this),
26029      GeometryCollection: this.segmentGeometryCollectionGeometry_.bind(this),
26030      Circle: this.segmentCircleGeometry_.bind(this)
26031    };
26032  }
26033  /**
26034   * Add a feature to the collection of features that we may snap to.
26035   * @param {import("../Feature.js").default} feature Feature.
26036   * @param {boolean} [register] Whether to listen to the feature change or not
26037   *     Defaults to `true`.
26038   * @api
26039   */
26040  addFeature(t, i) {
26041    i = i !== void 0 ? i : !0;
26042    const s = ot(t), n = t.getGeometry();
26043    if (n) {
26044      const r = this.GEOMETRY_SEGMENTERS_[n.getType()];
26045      if (r) {
26046        this.indexedFeaturesExtents_[s] = n.getExtent(
26047          ve()
26048        );
26049        const o = (
26050          /** @type {Array<Array<import('../coordinate.js').Coordinate>>} */
26051          []
26052        );
26053        if (r(o, n), o.length === 1)
26054          this.rBush_.insert(ce(o[0]), {
26055            feature: t,
26056            segment: o[0]
26057          });
26058        else if (o.length > 1) {
26059          const a = o.map((h) => ce(h)), l = o.map((h) => ({
26060            feature: t,
26061            segment: h
26062          }));
26063          this.rBush_.load(a, l);
26064        }
26065      }
26066    }
26067    i && (this.featureChangeListenerKeys_[s] = lt(
26068      t,
26069      et.CHANGE,
26070      this.handleFeatureChange_,
26071      this
26072    ));
26073  }
26074  /**
26075   * @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features.
26076   * @private
26077   */
26078  getFeatures_() {
26079    let t;
26080    return this.features_ ? t = this.features_ : this.source_ && (t = this.source_.getFeatures()), t;
26081  }
26082  /**
26083   * @param {import("../MapBrowserEvent.js").default} evt Map browser event.
26084   * @return {boolean} `false` to stop event propagation.
26085   */
26086  handleEvent(t) {
26087    const i = this.snapTo(t.pixel, t.coordinate, t.map);
26088    return i && (t.coordinate = i.vertex.slice(0, 2), t.pixel = i.vertexPixel), super.handleEvent(t);
26089  }
26090  /**
26091   * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent<import("../Feature.js").default>} evt Event.
26092   * @private
26093   */
26094  handleFeatureAdd_(t) {
26095    const i = rd(t);
26096    i && this.addFeature(i);
26097  }
26098  /**
26099   * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent<import("../Feature.js").default>} evt Event.
26100   * @private
26101   */
26102  handleFeatureRemove_(t) {
26103    const i = rd(t);
26104    i && this.removeFeature(i);
26105  }
26106  /**
26107   * @param {import("../events/Event.js").default} evt Event.
26108   * @private
26109   */
26110  handleFeatureChange_(t) {
26111    const i = (
26112      /** @type {import("../Feature.js").default} */
26113      t.target
26114    );
26115    if (this.handlingDownUpSequence) {
26116      const s = ot(i);
26117      s in this.pendingFeatures_ || (this.pendingFeatures_[s] = i);
26118    } else
26119      this.updateFeature_(i);
26120  }
26121  /**
26122   * Handle pointer up events.
26123   * @param {import("../MapBrowserEvent.js").default} evt Event.
26124   * @return {boolean} If the event was consumed.
26125   */
26126  handleUpEvent(t) {
26127    const i = Object.values(this.pendingFeatures_);
26128    return i.length && (i.forEach(this.updateFeature_.bind(this)), this.pendingFeatures_ = {}), !1;
26129  }
26130  /**
26131   * Remove a feature from the collection of features that we may snap to.
26132   * @param {import("../Feature.js").default} feature Feature
26133   * @param {boolean} [unlisten] Whether to unlisten to the feature change
26134   *     or not. Defaults to `true`.
26135   * @api
26136   */
26137  removeFeature(t, i) {
26138    const s = i !== void 0 ? i : !0, n = ot(t), r = this.indexedFeaturesExtents_[n];
26139    if (r) {
26140      const o = this.rBush_, a = [];
26141      o.forEachInExtent(r, function(l) {
26142        t === l.feature && a.push(l);
26143      });
26144      for (let l = a.length - 1; l >= 0; --l)
26145        o.remove(a[l]);
26146    }
26147    s && (Mt(this.featureChangeListenerKeys_[n]), delete this.featureChangeListenerKeys_[n]);
26148  }
26149  /**
26150   * Remove the interaction from its current map and attach it to the new map.
26151   * Subclasses may set up event handlers to get notified about changes to
26152   * the map here.
26153   * @param {import("../Map.js").default} map Map.
26154   */
26155  setMap(t) {
26156    const i = this.getMap(), s = this.featuresListenerKeys_, n = (
26157      /** @type {Array<import("../Feature.js").default>} */
26158      this.getFeatures_()
26159    );
26160    i && (s.forEach(Mt), s.length = 0, this.rBush_.clear(), Object.values(this.featureChangeListenerKeys_).forEach(Mt), this.featureChangeListenerKeys_ = {}), super.setMap(t), t && (this.features_ ? s.push(
26161      lt(
26162        this.features_,
26163        $t.ADD,
26164        this.handleFeatureAdd_,
26165        this
26166      ),
26167      lt(
26168        this.features_,
26169        $t.REMOVE,
26170        this.handleFeatureRemove_,
26171        this
26172      )
26173    ) : this.source_ && s.push(
26174      lt(
26175        this.source_,
26176        le.ADDFEATURE,
26177        this.handleFeatureAdd_,
26178        this
26179      ),
26180      lt(
26181        this.source_,
26182        le.REMOVEFEATURE,
26183        this.handleFeatureRemove_,
26184        this
26185      )
26186    ), n.forEach((r) => this.addFeature(r)));
26187  }
26188  /**
26189   * @param {import("../pixel.js").Pixel} pixel Pixel
26190   * @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
26191   * @param {import("../Map.js").default} map Map.
26192   * @return {Result|null} Snap result
26193   */
26194  snapTo(t, i, s) {
26195    s.getView().getProjection();
26196    const n = Pt(i), r = Qo(
26197      Ms(
26198        ce([n]),
26199        s.getView().getResolution() * this.pixelTolerance_
26200      )
26201    ), o = this.rBush_.getInExtent(r), a = o.length;
26202    if (a === 0)
26203      return null;
26204    let l, h = 1 / 0;
26205    const c = this.pixelTolerance_ * this.pixelTolerance_, u = () => {
26206      if (l) {
26207        const d = s.getPixelFromCoordinate(l);
26208        if (_i(t, d) <= c)
26209          return {
26210            vertex: l,
26211            vertexPixel: [
26212              Math.round(d[0]),
26213              Math.round(d[1])
26214            ]
26215          };
26216      }
26217      return null;
26218    };
26219    if (this.vertex_) {
26220      for (let f = 0; f < a; ++f) {
26221        const g = o[f];
26222        g.feature.getGeometry().getType() !== "Circle" && g.segment.forEach((_) => {
26223          const m = Pt(_), p = _i(n, m);
26224          p < h && (l = _, h = p);
26225        });
26226      }
26227      const d = u();
26228      if (d)
26229        return d;
26230    }
26231    if (this.edge_) {
26232      for (let f = 0; f < a; ++f) {
26233        let g = null;
26234        const _ = o[f];
26235        if (_.feature.getGeometry().getType() === "Circle") {
26236          let m = _.feature.getGeometry();
26237          g = a1(
26238            n,
26239            /** @type {import("../geom/Circle.js").default} */
26240            m
26241          );
26242        } else {
26243          const [m, p] = _.segment;
26244          p && (Ha[0] = Pt(m), Ha[1] = Pt(p), g = Zl(n, Ha));
26245        }
26246        if (g) {
26247          const m = _i(n, g);
26248          m < h && (l = Cs(g), h = m);
26249        }
26250      }
26251      const d = u();
26252      if (d)
26253        return d;
26254    }
26255    return null;
26256  }
26257  /**
26258   * @param {import("../Feature.js").default} feature Feature
26259   * @private
26260   */
26261  updateFeature_(t) {
26262    this.removeFeature(t, !1), this.addFeature(t, !1);
26263  }
26264  /**
26265   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26266   * @param {import("../geom/Circle.js").default} geometry Geometry.
26267   * @private
26268   */
26269  segmentCircleGeometry_(t, i) {
26270    this.getMap().getView().getProjection();
26271    const r = eM(i).getCoordinates()[0];
26272    for (let o = 0, a = r.length - 1; o < a; ++o)
26273      t.push(r.slice(o, o + 2));
26274  }
26275  /**
26276   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26277   * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
26278   * @private
26279   */
26280  segmentGeometryCollectionGeometry_(t, i) {
26281    const s = i.getGeometriesArray();
26282    for (let n = 0; n < s.length; ++n) {
26283      const r = this.GEOMETRY_SEGMENTERS_[s[n].getType()];
26284      r && r(t, s[n]);
26285    }
26286  }
26287  /**
26288   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26289   * @param {import("../geom/LineString.js").default} geometry Geometry.
26290   * @private
26291   */
26292  segmentLineStringGeometry_(t, i) {
26293    const s = i.getCoordinates();
26294    for (let n = 0, r = s.length - 1; n < r; ++n)
26295      t.push(s.slice(n, n + 2));
26296  }
26297  /**
26298   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26299   * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
26300   * @private
26301   */
26302  segmentMultiLineStringGeometry_(t, i) {
26303    const s = i.getCoordinates();
26304    for (let n = 0, r = s.length; n < r; ++n) {
26305      const o = s[n];
26306      for (let a = 0, l = o.length - 1; a < l; ++a)
26307        t.push(o.slice(a, a + 2));
26308    }
26309  }
26310  /**
26311   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26312   * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
26313   * @private
26314   */
26315  segmentMultiPointGeometry_(t, i) {
26316    i.getCoordinates().forEach((s) => {
26317      t.push([s]);
26318    });
26319  }
26320  /**
26321   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26322   * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
26323   * @private
26324   */
26325  segmentMultiPolygonGeometry_(t, i) {
26326    const s = i.getCoordinates();
26327    for (let n = 0, r = s.length; n < r; ++n) {
26328      const o = s[n];
26329      for (let a = 0, l = o.length; a < l; ++a) {
26330        const h = o[a];
26331        for (let c = 0, u = h.length - 1; c < u; ++c)
26332          t.push(h.slice(c, c + 2));
26333      }
26334    }
26335  }
26336  /**
26337   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26338   * @param {import("../geom/Point.js").default} geometry Geometry.
26339   * @private
26340   */
26341  segmentPointGeometry_(t, i) {
26342    t.push([i.getCoordinates()]);
26343  }
26344  /**
26345   * @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
26346   * @param {import("../geom/Polygon.js").default} geometry Geometry.
26347   * @private
26348   */
26349  segmentPolygonGeometry_(t, i) {
26350    const s = i.getCoordinates();
26351    for (let n = 0, r = s.length; n < r; ++n) {
26352      const o = s[n];
26353      for (let a = 0, l = o.length - 1; a < l; ++a)
26354        t.push(o.slice(a, a + 2));
26355    }
26356  }
26357}
26358const rw = nw, ao = 100, ow = {
26359  Point: "Point",
26360  LineString: "LineString",
26361  Polygon: "Polygon"
26362};
26363function ac(e) {
26364  return Array.isArray(e) ? Array.isArray(e[0]) ? e.map(ac) : [Math.round(e[0] * ao) / ao, Math.round(e[1] * ao) / ao] : e;
26365}
26366function od(e) {
26367  var n, r, o;
26368  const t = (n = e == null ? void 0 : e.getGeometry) == null ? void 0 : n.call(e), i = ow[(r = t == null ? void 0 : t.getType) == null ? void 0 : r.call(t)];
26369  if (!i)
26370    return null;
26371  const s = (o = t.getCoordinates) == null ? void 0 : o.call(t);
26372  return Array.isArray(s) ? { type: i, coordinates: ac(s) } : null;
26373}
26374function aw(e) {
26375  if (!e || !Array.isArray(e.coordinates))
26376    return !1;
26377  const t = (i) => new Set(i.map((s) => `${s[0]},${s[1]}`)).size;
26378  switch (e.type) {
26379    case "Point":
26380      return e.coordinates.length === 2 && e.coordinates.every(Number.isFinite);
26381    case "LineString":
26382      return t(e.coordinates) >= 2;
26383    case "Polygon":
26384      return t(e.coordinates[0] || []) >= 3;
26385    default:
26386      return !1;
26387  }
26388}
26389function Yg(e, t = 1) {
26390  const i = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(e ?? "").trim());
26391  if (!i)
26392    return e;
26393  let s = i[1];
26394  s.length === 3 && (s = s.split("").map((r) => r + r).join(""));
26395  const n = parseInt(s, 16);
26396  return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${t})`;
26397}
26398function Kg(e) {
26399  if (!e || !Array.isArray(e.coordinates))
26400    return null;
26401  let t;
26402  switch (e.type) {
26403    case "Point":
26404      t = [e.coordinates];
26405      break;
26406    case "LineString":
26407      t = e.coordinates;
26408      break;
26409    case "Polygon":
26410      t = (e.coordinates[0] || []).slice(0, -1);
26411      break;
26412    default:
26413      return null;
26414  }
26415  const i = /* @__PURE__ */ new Set(), s = t.filter((r) => {
26416    if (!Array.isArray(r) || !Number.isFinite(r[0]) || !Number.isFinite(r[1]))
26417      return !1;
26418    const o = `${r[0]},${r[1]}`;
26419    return i.has(o) ? !1 : (i.add(o), !0);
26420  });
26421  if (!s.length)
26422    return null;
26423  const n = s.reduce((r, o) => [r[0] + o[0], r[1] + o[1]], [0, 0]);
26424  return ac([n[0] / s.length, n[1] / s.length]);
26425}
26426const lw = ["select", "fail", "warn"];
26427function hw(e, t) {
26428  if (e == null)
26429    return null;
26430  const i = /^\s*([0-9]*\.?[0-9]+)\s*(px|m)?\s*$/i.exec(String(e));
26431  if (!i)
26432    return null;
26433  const s = Number(i[1]);
26434  return !Number.isFinite(s) || s < 0 ? null : (i[2] || "").toLowerCase() === "px" ? Number.isFinite(t) && t > 0 ? s * t : null : s;
26435}
26436function cw(e) {
26437  const t = String(e ?? "").trim().toLowerCase();
26438  return lw.includes(t) ? t : null;
26439}
26440function uw(e, t, i) {
26441  var n, r, o;
26442  if (!Array.isArray(e) || !Array.isArray(t) || !(i >= 0))
26443    return null;
26444  let s = null;
26445  for (const a of e) {
26446    const l = (n = a == null ? void 0 : a.getGeometry) == null ? void 0 : n.call(a);
26447    if (!(l != null && l.getClosestPoint))
26448      continue;
26449    const h = ((r = l.getType) == null ? void 0 : r.call(l)) === "Polygon" && ((o = l.intersectsCoordinate) == null ? void 0 : o.call(l, t)), c = h ? t : l.getClosestPoint(t), u = h ? 0 : Math.hypot(c[0] - t[0], c[1] - t[1]);
26450    u <= i && (!s || u < s.distance) && (s = { feature: a, distance: u, closest: c });
26451  }
26452  return s;
26453}
26454function dw(e, t, i) {
26455  var r;
26456  const s = (r = e == null ? void 0 : e.getSource) == null ? void 0 : r.call(e);
26457  if (!s)
26458    return [];
26459  const n = Math.max(i, 0);
26460  return s.getFeaturesInExtent ? s.getFeaturesInExtent([t[0] - n, t[1] - n, t[0] + n, t[1] + n]) : s.getFeatures ? s.getFeatures() : [];
26461}
26462const Za = (e) => Math.round(e * 100) / 100;
26463function fw(e, t) {
26464  var a, l, h, c, u, d, f;
26465  const i = { ...((l = (a = t.feature).getProperties) == null ? void 0 : l.call(a)) || {} };
26466  delete i.geometry;
26467  const s = ((h = e == null ? void 0 : e.get) == null ? void 0 : h.call(e, "assetId")) || "id", n = i[s], r = (u = (c = t.feature).getGeometry) == null ? void 0 : u.call(c), o = ((d = r == null ? void 0 : r.getType) == null ? void 0 : d.
26467call(r)) === "Point" ? r.getCoordinates() : t.closest;
26468  return {
26469    layerId: ((f = e == null ? void 0 : e.get) == null ? void 0 : f.call(e, "id")) ?? null,
26470    assetId: n == null || n === "" ? null : String(n),
26471    distance: Za(t.distance),
26472    coordinates: [Za(o[0]), Za(o[1])],
26473    properties: i
26474  };
26475}
26476function gw(e, t, { findLayer: i, resolution: s, messages: n } = {}) {
26477  const r = (n == null ? void 0 : n.generic) || "We could not check this location. Please try again.", o = e.message || (n == null ? void 0 : n.rule) || "This location cannot be used. Please choose another.", a = { name: e.name, url: null, layer: e.layer, data: null, status: null, selection: null, warning: null }, l = cw(e.match), h = hw(e.within, s);
26478  if (!e.layer || !l || h == null)
26479    return { ...a, passed: !1, reason: "error", message: r };
26480  const c = typeof i == "function" ? i(e.layer) : null;
26481  if (!c)
26482    return l !== "select" ? { ...a, passed: !0, reason: null, message: null } : { ...a, passed: !1, reason: "error", message: r };
26483  if (!Array.isArray(t))
26484    return l !== "select" ? { ...a, passed: !0, reason: null, message: null } : { ...a, passed: !1, reason: "rule", message: o };
26485  const u = uw(dw(c, t, h), t, h), d = u ? fw(c, u) : null;
26486  return l === "select" ? u ? { ...a, passed: !0, reason: null, message: null, data: d, selection: d } : { ...a, passed: !1, reason: "rule", message: o } : l === "warn" ? u ? { ...a, passed: !0, reason: null, message: null, data: d, warning: o } : { ...a, passed: !0, reason: null, message: null } : u ? { ...a, passed: !1, reason: "rule", message: o, data: d } : { ...a, passed: !0, reason: null, message: null };
26487}
26488const qg = 8e3, _w = 27700, Gn = "We could not check this location. Please try again.", ad = "This location cannot be used. Please choose another.", Nl = (e) => e !== null && typeof e == "object" && !Array.isArray(e);
26489function mw(e, [t, i]) {
26490  const s = String(e ?? ""), n = s.indexOf("#"), r = n === -1 ? s : s.slice(0, n), o = r.includes("?") ? r.endsWith("?") || r.endsWith("&") ? "" : "&" : "?";
26491  return `${r}${o}x=${encodeURIComponent(t)}&y=${encodeURIComponent(i)}`;
26492}
26493function pw(e, t) {
26494  const i = {};
26495  return e.apiKey && (i["x-api-key"] = e.apiKey), (t == null ? void 0 : t.type) === "Point" ? { url: mw(e.url, t.coordinates), init: { method: "GET", headers: i } } : (i["content-type"] = "application/json", {
26496    url: String(e.url ?? ""),
26497    init: { method: "POST", headers: i, body: JSON.stringify({ geometry: t, srid: _w }) }
26498  });
26499}
26500function Vg(e) {
26501  return e == null ? !0 : Array.isArray(e) ? e.length === 0 : Nl(e) ? Array.isArray(e.matches) ? e.matches.length === 0 : Array.isArray(e.results) ? e.results.every(Vg) : e.found === !1 ? !0 : Object.keys(e).length === 0 : !1;
26502}
26503function yw(e, { required: t = !1 } = {}) {
26504  const i = typeof e == "string" && /^(true|false)$/i.test(e.trim()) ? e.trim().toLowerCase() === "true" : e;
26505  return i === !0 ? { passed: !0, reason: null } : i === !1 ? { passed: !1, reason: "rule" } : t && Vg(i) ? { passed: !1, reason: "empty" } : { passed: !0, reason: null };
26506}
26507const Ja = (e, t) => Number.isFinite(Number(e)) && Number.isFinite(Number(t)) ? [Number(e), Number(t)] : null;
26508function Gl(e, t = 8) {
26509  let i = null;
26510  const s = (n, r) => {
26511    if (r > t || n == null || typeof n != "object")
26512      return null;
26513    if (Array.isArray(n)) {
26514      for (const o of n) {
26515        const a = s(o, r + 1);
26516        if (a)
26517          return a;
26518      }
26519      return null;
26520    }
26521    if (n.type === "Point" && Array.isArray(n.coordinates)) {
26522      const o = Ja(n.coordinates[0], n.coordinates[1]);
26523      if (o)
26524        return o;
26525    }
26526    i || (i = Ja(n.easting, n.northing) || Ja(n.x, n.y) || null);
26527    for (const o of Object.keys(n)) {
26528      const a = s(n[o], r + 1);
26529      if (a)
26530        return a;
26531    }
26532    return null;
26533  };
26534  return s(e, 0) || i;
26535}
26536function xw(e, t, i = 8) {
26537  const s = String(t ?? "").trim();
26538  if (!s)
26539    return null;
26540  let n = null;
26541  const r = (g, _, m) => {
26542    if (_ > i || g == null || typeof g != "object")
26543      return null;
26544    if (Array.isArray(g)) {
26545      for (const E of g) {
26546        const C = r(E, _ + 1, m);
26547        if (C)
26548          return C;
26549      }
26550      return null;
26551    }
26552    const p = typeof g.layer == "string" ? g.layer : m, y = Nl(g.attributes) ? g.attributes : null;
26553    if (Object.prototype.hasOwnProperty.call(g, s) || y && Object.prototype.hasOwnProperty.call(y, s))
26554      return { node: g, layer: p };
26555    !n && Gl(g, 1) && (n = { node: g, layer: p });
26556    for (const E of Object.keys(g)) {
26557      if (E === "attributes")
26558        continue;
26559      const C = r(g[E], _ + 1, p);
26560      if (C)
26561        return C;
26562    }
26563    return null;
26564  }, o = r(e, 0, null) || n;
26565  if (!o)
26566    return null;
26567  const { node: a, layer: l } = o, h = Nl(a.attributes) ? a.attributes : {}, c = Object.prototype.hasOwnProperty.call(a, s) ? a[s] : h[s], u = Gl(a), d = { ...h };
26568  for (const g of ["id", "name"])
26569    a[g] != null && !(g in d) && (d[g] = a[g]);
26570  const f = Number.isFinite(Number(a.distance)) ? Math.round(Number(a.distance) * 100) / 100 : null;
26571  return {
26572    layerId: l ?? null,
26573    assetId: c == null || c === "" ? null : String(c),
26574    distance: f,
26575    coordinates: u ? [Math.round(u[0] * 100) / 100, Math.round(u[1] * 100) / 100] : null,
26576    properties: d
26577  };
26578}
26579async function vw(e, t, { fetchFn: i = globalThis.fetch, timeoutMs: s, signal: n, findLayer: r, resolution: o } = {}) {
26580  if (e.layer || !e.url && (e.within != null || e.match)) {
26581    const m = (t == null ? void 0 : t.type) === "Point" ? t.coordinates : String(e.match ?? "").toLowerCase() === "select" ? null : Kg(t);
26582    return gw(e, m, { findLayer: r, resolution: o, messages: { generic: Gn, rule: ad } });
26583  }
26584  const { url: a, init: l } = pw(e, t), h = e.message || ad, c = { name: e.name, url: a, data: null, status: null }, u = new AbortController();
26585  let d = !1;
26586  const f = Number.isFinite(Number(s ?? e.timeout)) && Number(s ?? e.timeout) > 0 ? Number(s ?? e.timeout) : qg, g = setTimeout(() => {
26587    d = !0, u.abort();
26588  }, f), _ = () => u.abort();
26589  n && (n.aborted ? _() : n.addEventListener("abort", _, { once: !0 }));
26590  try {
26591    const m = await i(a, { ...l, signal: u.signal }), p = await m.text();
26592    if (!m.ok)
26593      return { ...c, status: m.status, passed: !1, reason: "error", message: Gn };
26594    let y;
26595    try {
26596      y = p.trim() === "" ? null : JSON.parse(p);
26597    } catch {
26598      return { ...c, status: m.status, passed: !1, reason: "error", message: Gn };
26599    }
26600    const { passed: v, reason: E } = yw(y, { required: !!e.required }), C = v && e.assetId && y !== null && typeof y == "object" ? xw(y, e.assetId) : null;
26601    return { ...c, status: m.status, data: y, passed: v, reason: E, message: v ? null : h, selection: C };
26602  } catch (m) {
26603    return (m == null ? void 0 : m.name) === "AbortError" || u.signal.aborted ? d ? { ...c, passed: !1, reason: "timeout", message: Gn } : { ...c, passed: !1, reason: "aborted", message: null } : { ...c, passed: !1, reason: "error", message: Gn };
26604  } finally {
26605    clearTimeout(g), n && n.removeEventListener("abort", _);
26606  }
26607}
26608function Ew(e) {
26609  const t = {};
26610  let i = !0;
26611  for (const s of e)
26612    t[s.name] = { passed: s.passed, data: s.data, reason: s.reason, warning: s.warning ?? null }, s.passed || (i = !1);
26613  return { passed: i, results: t };
26614}
26615const Mw = `:root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}
26615.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-control{background-color:var(--xmap-primary);border:1px solid var(--xmap-secondary)}.ol-control button{background-color:var(--xmap-primary);margin:0;color:var(--xmap-secondary);font-size:1.2em;line-height:1.2em}.ol-control button:hover{background-color:var(--xmap-secondary);color:var(--xmap-primary);outline:none;cursor:pointer}.xmap-web-map-container{height:100%;width:100%;position:relative}.xmap-draw-hud{position:absolute;top:.5em;right:.5em;z-index:1;padding:2px}.xmap-draw-hud button{display:flex;align-items:center;justify-content:center;width:1.7em;height:1.7em;padding:0;line-height:1}.xmap-check-banner{position:absolute;left:.5em;right:.5em;bottom:.5em;z-index:1;padding:.5em .75em;border-radius:4px;border:1px solid var(--xmap-secondary);background-color:var(--xmap-primary);color:var(--xmap-secondary);font-size:.95em;line-height:1.3;pointer-events:none}.xmap-check-banner--fail{border-left:.4em solid #c0392b}.xmap-check-banner--warn{border-left:.4em solid #e67e22}.xmap-web-map-footer{align-self:flex-end}#xmap-map{height:100%;min-height:0}
26616`, Cw = {
26617  name: "XmapWebMap",
26618  inject: ["primaryColor", "secondaryColor"],
26619  emits: ["xmap-geometry-changed", "xmap-geometry-cleared"],
26620  props: {
26621    extent: {
26622      type: String,
26623      default: null
26624    },
26625    width: {
26626      type: Number,
26627      default: "auto"
26628    },
26629    height: {
26630      type: Number,
26631      default: "auto"
26632    },
26633    x: {
26634      type: Number,
26635      default: 0
26636    },
26637    y: {
26638      type: Number,
26639      default: 0
26640    },
26641    z: {
26642      type: Number,
26643      default: 0
26644    },
26645    // Interaction mode, not a layer: "point" | "line" | "polygon".
26646    // Per the object-vs-behaviour principle, draw is an attribute on the map.
26647    draw: {
26648      type: String,
26649      default: null
26650    }
26651  },
26652  methods: {
26653    updateMaxWidth() {
26654      this.maxWidth = this.$parent.$refs.xmapMain.clientWidth;
26655    },
26656    updateMaxHeight() {
26657      this.maxHeight = this.$parent.$refs.xmapMain.clientHeight;
26658    },
26659    // Fit the view to an arbitrary extent, deferring until the map has a real
26660    // size (XMP-2228). Shared by the map's own `extent` and by child layers'
26661    // `fit` (XMP-2234). Returns true when applied now.
26662    fitToExtent(e, t = {}) {
26663      if (!this.map || !e)
26664        return !1;
26665      const i = this.map.getSize();
26666      return !i || !i[0] || !i[1] ? (this.map.once("change:size", () => this.fitToExtent(e, t)), !1) : (this.map.getView().fit(e, { size: i, ...t }), !0);
26667    },
26668    // Fit the view to `extent`. Returns true when applied. No-op without an
26669    // extent; deferred until the first non-zero size when the map is unsized.
26670    // Keeps its own guard so `_pendingFit` still means "one pending fit of the
26671    // map's own extent" and a deferred layer fit cannot cancel it.
26672    fitExtent() {
26673      if (!this.map || !this.extent)
26674        return !1;
26675      const e = this.map.getSize();
26676      return !e || !e[0] || !e[1] ? (this._pendingFit || (this._pendingFit = !0, this.map.once("change:size", () => {
26677        this._pendingFit = !1, this.fitExtent();
26678      })), !1) : this.fitToExtent(this.formattedExtent);
26679    },
26680    // ---- Draw / Report It ---------------------------------------------------
26681    setupDraw() {
26682      if (!this.map || !this.drawType)
26683        return;
26684      this.teardownDraw();
26685      const e = this.primaryColor || "#263746";
26686      this._drawSource = new va(), this._drawLayer = new xa({
26687        source: this._drawSource,
26688        zIndex: 100,
26689        // One style covers all three geometry types: `stroke` draws the line and
26690        // the polygon outline, `fill` gives the polygon body (which also makes it
26691        // grabbable by its interior, not just its edges), and `image` keeps point
26692        // rendering plus vertex visibility for Modify. A style carrying only
26693        // `image` renders lines and polygons as nothing at all.
26694        style: new pr({
26695          stroke: new vi({ color: e, width: 3 }),
26696          fill: new Mi({ color: Yg(e, 0.2) }),
26697          image: new Fr({
26698            radius: 7,
26699            fill: new Mi({ color: e }),
26700            stroke: new vi({ color: "#fff", width: 2 })
26701          })
26702        })
26703      }), this.map.addLayer(this._drawLayer), this.drawType !== "Point" && (this._dblClickZoom = this.map.getInteractions().getArray().find((t) => t instanceof _g) || null, this._dblClickZoom && this._dblClickZoom.setActive(!1)), this._draw = new sw({ source: this._drawSource, type: this.drawType }), this._modify = new qb({ source: this._drawSource }), this._snap = new rw({ source: this._drawSource }), this.map.addInteraction(this._draw), this.map.addInteraction(this._modify), this.map.addInteraction(this._snap), this._draw.on("drawend", (t) => {
26704        this._draw.setActive(!1), this.captureGeometry(t.feature);
26705      }), this._modify.on("modifyend", (t) => this.captureGeometry(t.features.item(0)));
26706    },
26707    // Remove the drawn geometry and re-enable drawing a new one (e.g. after submit).
26708    clearMapPoint() {
26709      this._drawSource && this._drawSource.clear(), this._draw && this._draw.setActive(!0), sd();
26710    },
26711    // Public counterpart to clearMapPoint(): removes the geometry AND tells the host.
26712    // Used by the Clear control and exposed on the custom element as clearGeometry().
26713    // Only announces when there was something to clear, so (a) a first draw that is
26714    // immediately degenerate stays silent, and (b) the post-submit reset — where
26715    // requestReportReset() has already emptied the bus — does not fire a spurious
26716    // event on top of xmap-report-submitted.
26717    clearGeometry() {
26718      const e = ne.hasPoint, t = !!this.checking;
26719      this.abortChecks(), this.clearMapPoint(), e && this.emitHost("xmap-geometry-cleared", {});
26720      const i = !!this._lastPassing;
26721      this._lastPassing = null, this._selection = null, this.checkBanner = null, this.hasChecks() && (e || t || i) && this.emitChecksCleared();
26722    },
26723    teardownDraw() {
26724      this._draw && this.map && this.map.removeInteraction(this._draw), this._draw = null, this._modify && this.map && this.map.removeInteraction(this._modify), this._modify = null, this._snap && this.map && this.map.removeInteraction(this._snap), this._snap = null, this._drawLayer && this.map && this.map.removeLayer(this._drawLayer), this._drawLayer = null, this._drawSource = null, this._dblClickZoom && this._dblClickZoom.setActive(!0), this._dblClickZoom = null, sd();
26725    },
26726    // Capture whatever was drawn (Point | LineString | Polygon) as GeoJSON in
26727    // EPSG:27700 — the map's native projection, so no reprojection.
26728    //
26729    // With <xmap-web-check> children declared, the raw draw is still announced
26730    // (xmap-geometry-changed, the bus) and then the checks run; a failing check
26731    // reverts the selection (see runChecks). `run: false` is the internal
26732    // re-capture after a snap, which must not start a second run.
26733    captureGeometry(e, { run: t = !0 } = {}) {
26734      const i = od(e);
26735      if (!aw(i)) {
26736        this.clearGeometry();
26737        return;
26738      }
26739      if (id(i), this.emitHost("xmap-geometry-changed", this.geometryDetail(i)), !!t) {
26740        if (this.hasChecks())
26741          return this.runChecks(e, i);
26742        this.rememberPassing(e, i);
26743      }
26744    },
26745    geometryDetail(e) {
26746      return {
26747        geometry: e,
26748        type: e.type,
26749        coordinates: e.coordinates,
26750        // Kept for the common point case so a listener reads coordinates directly.
26751        ...e.type === "Point" ? { easting: e.coordinates[0], northing: e.coordinates[1] } : {},
26752        point: this.pointDetail(e),
26753        // The asset a match="select" layer check put the pin on, or null.
26754        selection: this._selection || null
26755      };
26756    },
26757    // A representative EPSG:27700 position with its WGS84 equivalent, for hosts
26758    // that store a location summary next to the geometry (the PCF's `details`
26759    // bound format). null when the geometry has no usable position.
26760    pointDetail(e) {
26761      const t = Kg(e);
26762      if (!t)
26763        return null;
26764      let i = null;
26765      try {
26766        i = Jo(t, "EPSG:27700", "EPSG:4326");
26767      } catch {
26768        i = null;
26769      }
26770      const s = (n) => Math.round(n * 1e6) / 1e6;
26771      return {
26772        easting: t[0],
26773        northing: t[1],
26774        longitude: i ? s(i[0]) : null,
26775        latitude: i ? s(i[1]) : null
26776      };
26777    },
26778    // ---- Location checks (<xmap-web-check>) ---------------------------------
26779    //
26780    // Mirrors what Walsall's WMBC.Mapping control does: a selection that fails
26781    // its checks is refused outright. The drawn geometry is removed and the
26782    // last one that passed is put back, so what is on the map is always what
26783    // the host (and a bound form column) has been told about. With no checks
26784    // declared none of this runs and the map behaves exactly as before.
26785    // Registered by <xmap-web-check> on mount. Plain array, never reactive:
26786    // these are component instances (see the markRaw note in created()).
26787    registerCheck(e) {
26788      this._checks || (this._checks = []), this._checks.includes(e) || this._checks.push(e);
26789    },
26790    unregisterCheck(e) {
26791      this._checks && (this._checks = this._checks.filter((t) => t !== e));
26792    },
26793    hasChecks() {
26794      return !!(this._checks && this._checks.length);
26795    },
26796    // A layer by its `layer-id` (the OL layer's `id` property), for layer checks.
26797    findLayer(e) {
26798      return !this.map || !e ? null : this.map.getLayers().getArray().find((t) => t.get && t.get("id") === e) || null;
26799    },
26800    // The most recent geometry every check accepted (or, with no checks, the
26801    // most recent geometry full stop). `coords` are the raw OL coordinates so a
26802    // rejected Modify restores the exact previous vertices, not rounded ones.
26803    rememberPassing(e, t) {
26804      var s, n, r;
26805      const i = (r = (n = (s = e == null ? void 0 : e.getGeometry) == null ? void 0 : s.call(e)) == null ? void 0 : n.getCoordinates) == null ? void 0 : r.call(n);
26806      this._lastPassing = { geometry: t, type: t.type, coords: i ?? t.coordinates, selection: this._selection || null };
26807    },
26808    // Abandon an in-flight run: its results are dropped when they arrive.
26809    abortChecks() {
26810      this._runToken = (this._runToken || 0) + 1, this._checkController && (this._checkController.abort(), this._checkController = null), this.checking = !1;
26811    },
26812    async runChecks(e, t) {
26813      var l, h, c, u;
26814      this.abortChecks();
26815      const i = this._runToken, s = new AbortController();
26816      this._checkController = s;
26817      const n = this._checks.map((d) => d.spec());
26818      this.checking = !0, this.checkBanner = null, this._selection = null;
26819      const r = (u = (c = (h = (l = this.map) == null ? void 0 : l.getView) == null ? void 0 : h.call(l)) == null ? void 0 : c.getResolution) == null ? void 0 : u.call(c), o = await Promise.all(n.map(
26820        (d) => vw(d, t, {
26821          signal: s.signal,
26822          fetchFn: this._checkFetch || void 0,
26823          findLayer: (f) => this.findLayer(f),
26824          resolution: r
26825        })
26826      ));
26827      if (i !== this._runToken)
26828        return;
26829      this._checkController = null, this.checking = !1;
26830      const a = o.every((d) => d.passed) ? this.commitChecks(e, t, n, o) : this.revertChecks(e);
26831      this.emitCheckEvents(n, o, a);
26832    },
26833    // Every check passed. A snap="true" check that returned coordinates moves
26834    // the drawn point onto them (nearest asset); the re-capture announces the
26835    // moved geometry without starting another run.
26836    // Every check passed. A layer check with match="select" moves the pin onto
26837    // the asset it found and records the selection; a URL check with asset-id
26838    // records its nearest match as the selection and moves the pin only when it
26839    // also says snap="true"; failing both, a snap="true" URL check that returned
26840    // coordinates moves it. Either way the re-capture announces the moved
26841    // geometry without starting another run. Snaps happen only now, after every
26842    // rule has passed, so all rules judged the same click.
26843    commitChecks(e, t, i, s) {
26844      var a;
26845      let n = t;
26846      const r = s.findIndex((l) => l.selection), o = r === -1 ? null : s[r];
26847      if (this._selection = o ? o.selection : null, t.type === "Point") {
26848        let h = o && (i[r].layer || i[r].snap) && o.selection.coordinates || null;
26849        if (!h)
26850          for (let u = 0; u < i.length && !h; u++)
26851            i[u].snap && (h = Gl(s[u].data));
26852        const c = (a = e == null ? void 0 : e.getGeometry) == null ? void 0 : a.call(e);
26853        h && (c != null && c.setCoordinates) && (c.setCoordinates(h), this.captureGeometry(e, { run: !1 }), n = od(e) || t);
26854      }
26855      return this.rememberPassing(e, n), this.checkBanner = null, { geometry: n, reason: "passed" };
26856    },
26857    // A check failed: refuse the selection. A rejected edit of a previously
26858    // passing geometry puts the old vertices back; a rejected first draw leaves
26859    // the map empty with Draw re-enabled.
26860    revertChecks(e) {
26861      var s, n;
26862      this._selection = this._lastPassing && this._lastPassing.selection || null;
26863      const t = this._lastPassing, i = (s = e == null ? void 0 : e.getGeometry) == null ? void 0 : s.call(e);
26864      return t && ((n = i == null ? void 0 : i.getType) == null ? void 0 : n.call(i)) === t.type && i.setCoordinates ? (i.setCoordinates(t.coords), this._drawSource && !this._drawSource.hasFeature(e) && this._drawSource.addFeature(e), this._draw && this._draw.setActive(!1), id(t.geometry), this.emitHost("xmap-geometry-changed", this.geometryDetail(t.geometry)), { geometry: t.geometry, reason: "rejected" }) : (this._lastPassing = null, this.clearMapPoint(), this.emitHost("xmap-geometry-cleared", {}), { geometry: null, reason: "rejected" });
26865    },
26866    // After the map has committed or reverted, so a listener already sees the
26867    // final state: one xmap-check-result per check, one xmap-check-failed per
26868    // failing check (cancelable: preventDefault() suppresses the banner), then
26869    // one xmap-checks-completed. The banner shows the first failing check that
26870    // was not suppressed, in declaration order. When every check passed, each
26871    // warn rule that found something fires xmap-check-warned (also cancelable)
26872    // and the first unsuppressed one becomes a warn banner: the pin stays.
26873    emitCheckEvents(e, t, i) {
26874      const s = Ew(t);
26875      for (const o of t)
26876        this.emitHost("xmap-check-result", { name: o.name, url: o.url, passed: o.passed, data: o.data, reason: o.reason, warning: o.warning ?? null });
26877      let n = null, r = "fail";
26878      t.forEach((o, a) => {
26879        if (o.passed)
26880          return;
26881        const l = this.emitHost(
26882          "xmap-check-failed",
26883          { name: o.name, url: o.url, message: o.message, reason: o.reason, data: o.data, status: o.status },
26884          { cancelable: !0 }
26885        );
26886        n === null && e[a].banner && l !== !1 && (n = o.message);
26887      }), i.reason === "passed" && t.forEach((o, a) => {
26888        if (!o.warning)
26889          return;
26890        const l = this.emitHost(
26891          "xmap-check-warned",
26892          { name: o.name, layer: o.layer ?? null, message: o.warning, data: o.data },
26893          { cancelable: !0 }
26894        );
26895        n === null && e[a].banner && l !== !1 && (n = o.warning, r = "warn");
26896      }), this.emitHost("xmap-checks-completed", {
26897        passed: s.passed,
26898        results: s.results,
26899        geometry: i.geometry,
26900        reason: i.reason,
26901        point: i.geometry ? this.pointDetail(i.geometry) : null,
26902        selection: i.geometry && this._selection || null
26903      }), i.reason === "passed" && this._selection && this.emitHost("xmap-asset-selected", { ...this._selection, geometry: i.geometry }), this.checkBanner = n ? { kind: r, text: n } : null;
26904    },
26905    emitChecksCleared() {
26906      this.emitHost("xmap-checks-completed", { passed: !1, results: {}, geometry: null, reason: "cleared", point: null, selection: null });
26907    },
26908    // Dispatch on the custom-element host so the event reaches the host page
26909    // (composed:true to cross the shadow boundary). Returns dispatchEvent's
26910    // result: false when a cancelable event had preventDefault() called on it.
26911    emitHost(e, t, { cancelable: i = !1 } = {}) {
26912      var n, r, o;
26913      const s = ((o = (r = (n = this.$el) == null ? void 0 : n.getRootNode) == null ? void 0 : r.call(n)) == null ? void 0 : o.host) || this.$el;
26914      return s == null ? void 0 : s.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0, cancelable: i }));
26915    }
26916  },
26917  computed: {
26918    drawType() {
26919      return this.draw && { point: "Point", line: "LineString", polygon: "Polygon" }[String(this.draw).toLowerCase()] || null;
26920    },
26921    // Drives the Clear control. Reads the bus rather than the vector source so it
26922    // stays reactive — an OL source is markRaw'd and its mutations are invisible to Vue.
26923    hasGeometry() {
26924      return ne.hasPoint;
26925    },
26926    busResetSeq() {
26927      return ne.resetSeq;
26928    },
26929    mapX: {
26930      get() {
26931        return this.x;
26932      },
26933      set(e) {
26934        this.$emit("update:x", e);
26935      }
26936    },
26937    formattedExtent() {
26938      return this.extent && Array.isArray(this.extent) ? this.extent : this.extent ? this.extent.split(",").map((e) => Number(e)) : [Number(this.mapX), Number(this.y), Number(this.mapX), Number(this.y)];
26939    }
26940  },
26941  data: () => ({
26942    map: null,
26943    maxWidth: 0,
26944    maxHeight: 0,
26945    // Location checks banner state (the only reactive check state; the
26946    // registered check components and the last passing geometry are plain fields).
26947    checking: !1,
26948    checkBanner: null
26949    // {kind: 'fail' | 'warn', text}
26950  }),
26951  mounted() {
26952    this.$nextTick(() => {
26953      var t, i, s;
26954      this.updateMaxWidth(), this.updateMaxHeight(), this.map.setTarget(this.$refs.map), window.XMAP_MAP = this.map, this.draw && this.setupDraw();
26955      const e = (s = (i = (t = this.$el) == null ? void 0 : t.getRootNode) == null ? void 0 : i.call(t)) == null ? void 0 : s.host;
26956      e && (e.clearGeometry = () => this.clearGeometry()), this.$nextTick(() => this.fitExtent());
26957    }), window.addEventListener("resize", (e) => {
26958      this.updateMaxWidth(), this.updateMaxHeight(), this.map.updateSize();
26959    });
26960  },
26961  watch: {
26962    // Re-fit when the host changes the attribute after mount.
26963    extent() {
26964      this.fitExtent();
26965    },
26966    // Toggle draw mode reactively when the attribute is set/changed/removed.
26967    draw() {
26968      var t, i, s;
26969      if (!this.map)
26970        return;
26971      this.teardownDraw(), this.draw && this.setupDraw();
26972      const e = (s = (i = (t = this.$el) == null ? void 0 : t.getRootNode) == null ? void 0 : i.call(t)) == null ? void 0 : s.host;
26973      e && (e.clearGeometry = () => this.clearGeometry());
26974    },
26975    // The form requests a reset after a successful submit -> clear the point.
26976    // Drives the Clear control. Reads the bus rather than the vector source so it
26977    // stays reactive — an OL source is markRaw'd and its mutations are invisible to Vue.
26978    hasGeometry() {
26979      return ne.hasPoint;
26980    },
26981    busResetSeq() {
26982      this.abortChecks(), this.clearMapPoint();
26983      const e = !!this._lastPassing;
26984      this._lastPassing = null, this.checkBanner = null, this.hasChecks() && e && this.emitChecksCleared();
26985    }
26986  },
26987  beforeUnmount() {
26988    this.abortChecks(), this.teardownDraw();
26989  },
26990  created() {
26991    let e = ii(this.formattedExtent);
26992    this.map = yn(new vC({
26993      view: new qe({
26994        projection: "EPSG:27700",
26995        center: e,
26996        zoom: this.z || 0,
26997        constrainResolution: !1
26998      })
26999    })), this.map.on("moveend", (t) => {
27000      let i = t.map.getView().getCenter();
27001      this.mapX = i[0], i[1], t.map.getView().getZoom();
27002    });
27003  }
27004}, bw = {
27005  ref: "map",
27006  id: "xmap-map"
27007}, ww = {
27008  key: 0,
27009  class: "ol-control xmap-draw-hud"
27010}, Sw = /* @__PURE__ */ Nt("svg", {
27011  viewBox: "0 0 24 24",
27012  width: "1em",
27013  height: "1em",
27014  fill: "none",
27015  stroke: "currentColor",
27016  "stroke-width": "2",
27017  "stroke-linecap": "round",
27018  "stroke-linejoin": "round",
27019  "aria-hidden": "true",
27020  focusable: "false"
27021}, [
27022  /* @__PURE__ */ Nt("path", { d: "M3 6h18" }),
27023  /* @__PURE__ */ Nt("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
27024  /* @__PURE__ */ Nt("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
27025  /* @__PURE__ */ Nt("path", { d: "M10 11v6" }),
27026  /* @__PURE__ */ Nt("path", { d: "M14 11v6" })
27027], -1), Tw = [
27028  Sw
27029];
27030function Rw(e, t, i, s, n, r) {
27031  var o, a;
27032  return wt(), It("div", {
27033    class: "xmap-web-map xmap-web-map-container",
27034    style: Pr({
27035      width: `${e.maxWidth}px`,
27036      height: `${e.maxHeight}px`,
27037      "--xmap-primary": r.primaryColor || "#263746",
27038      "--xmap-secondary": r.secondaryColor || "#a1d0ca"
27039    })
27040  }, [
27041    Nt("div", bw, null, 512),
27042    r.drawType && r.hasGeometry ? (wt(), It("div", ww, [
27043      Nt("button", {
27044        type: "button",
27045        onClick: t[0] || (t[0] = (l) => r.clearGeometry()),
27046        "aria-label": "Clear drawing",
27047        title: "Clear drawing"
27048      }, Tw)
27049    ])) : qi("", !0),
27050    e.checking || e.checkBanner ? (wt(), It("div", {
27051      key: 1,
27052      class: bs(["xmap-check-banner", {
27053        "xmap-check-banner--fail": !e.checking && ((o = e.checkBanner) == null ? void 0 : o.kind) === "fail",
27054        "xmap-check-banner--warn": !e.checking && ((a = e.checkBanner) == null ? void 0 : a.kind) === "warn"
27055      }]),
27056      role: "status",
27057      "aria-live": "polite"
27058    }, fi(e.checking ? "Checking the location…" : e.checkBanner.text), 3)) : qi("", !0)
27059  ], 4);
27060}
27061const Iw = /* @__PURE__ */ ca(Cw, [["render", Rw], ["styles", [Mw]]]), Hg = 0.5, Pw = 10, ld = 0.25;
27062class Aw {
27063  /**
27064   * @param {import("../proj/Projection.js").default} sourceProj Source projection.
27065   * @param {import("../proj/Projection.js").default} targetProj Target projection.
27066   * @param {import("../extent.js").Extent} targetExtent Target extent to triangulate.
27067   * @param {import("../extent.js").Extent} maxSourceExtent Maximal source extent that can be used.
27068   * @param {number} errorThreshold Acceptable error (in source units).
27069   * @param {?number} destinationResolution The (optional) resolution of the destination.
27070   */
27071  constructor(t, i, s, n, r, o) {
27072    this.sourceProj_ = t, this.targetProj_ = i;
27073    let a = {};
27074    const l = nr(this.targetProj_, this.sourceProj_);
27075    this.transformInv_ = function(y) {
27076      const v = y[0] + "/" + y[1];
27077      return a[v] || (a[v] = l(y)), a[v];
27078    }, this.maxSourceExtent_ = n, this.errorThresholdSquared_ = r * r, this.triangles_ = [], this.wrapsXInSource_ = !1, this.canWrapXInSource_ = this.sourceProj_.canWrapX() && !!n && !!this.sourceProj_.getExtent() && mt(n) >= mt(this.sourceProj_.getExtent()), this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? mt(this.sourceProj_.getExtent()) : null, this.targetWorldWidth_ = this.targetProj_.getExtent() ? mt(this.targetProj_.getExtent()) : null;
27079    const h = Rs(s), c = Zo(s), u = Ho(s), d = Vo(s), f = this.transformInv_(h), g = this.transformInv_(c), _ = this.transformInv_(u), m = this.transformInv_(d), p = Pw + (o ? Math.max(
27080      0,
27081      Math.ceil(
27082        Math.log2(
27083          hl(s) / (o * o * 256 * 256)
27084        )
27085      )
27086    ) : 0);
27087    if (this.addQuad_(
27088      h,
27089      c,
27090      u,
27091      d,
27092      f,
27093      g,
27094      _,
27095      m,
27096      p
27097    ), this.wrapsXInSource_) {
27098      let y = 1 / 0;
27099      this.triangles_.forEach(function(v, E, C) {
27100        y = Math.min(
27101          y,
27102          v.source[0][0],
27103          v.source[1][0],
27104          v.source[2][0]
27105        );
27106      }), this.triangles_.forEach((v) => {
27107        if (Math.max(
27108          v.source[0][0],
27109          v.source[1][0],
27110          v.source[2][0]
27111        ) - y > this.sourceWorldWidth_ / 2) {
27112          const E = [
27113            [v.source[0][0], v.source[0][1]],
27114            [v.source[1][0], v.source[1][1]],
27115            [v.source[2][0], v.source[2][1]]
27116          ];
27117          E[0][0] - y > this.sourceWorldWidth_ / 2 && (E[0][0] -= this.sourceWorldWidth_), E[1][0] - y > this.sourceWorldWidth_ / 2 && (E[1][0] -= this.sourceWorldWidth_), E[2][0] - y > this.sourceWorldWidth_ / 2 && (E[2][0] -= this.sourceWorldWidth_);
27118          const C = Math.min(
27119            E[0][0],
27120            E[1][0],
27121            E[2][0]
27122          );
27123          Math.max(
27124            E[0][0],
27125            E[1][0],
27126            E[2][0]
27127          ) - C < this.sourceWorldWidth_ / 2 && (v.source = E);
27128        }
27129      });
27130    }
27131    a = {};
27132  }
27133  /**
27134   * Adds triangle to the triangulation.
27135   * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
27136   * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
27137   * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
27138   * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
27139   * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
27140   * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
27141   * @private
27142   */
27143  addTriangle_(t, i, s, n, r, o) {
27144    this.triangles_.push({
27145      source: [n, r, o],
27146      target: [t, i, s]
27147    });
27148  }
27149  /**
27150   * Adds quad (points in clock-wise order) to the triangulation
27151   * (and reprojects the vertices) if valid.
27152   * Performs quad subdivision if needed to increase precision.
27153   *
27154   * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
27155   * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
27156   * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
27157   * @param {import("../coordinate.js").Coordinate} d The target d coordinate.
27158   * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
27159   * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
27160   * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
27161   * @param {import("../coordinate.js").Coordinate} dSrc The source d coordinate.
27162   * @param {number} maxSubdivision Maximal allowed subdivision of the quad.
27163   * @private
27164   */
27165  addQuad_(t, i, s, n, r, o, a, l, h) {
27166    const c = ce([r, o, a, l]), u = this.sourceWorldWidth_ ? mt(c) / this.sourceWorldWidth_ : null, d = (
27167      /** @type {number} */
27168      this.sourceWorldWidth_
27169    ), f = this.sourceProj_.canWrapX() && u > 0.5 && u < 1;
27170    let g = !1;
27171    if (h > 0) {
27172      if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
27173        const m = ce([t, i, s, n]);
27174        g = mt(m) / this.targetWorldWidth_ > ld || g;
27175      }
27176      !f && this.sourceProj_.isGlobal() && u && (g = u > ld || g);
27177    }
27178    if (!g && this.maxSourceExtent_ && isFinite(c[0]) && isFinite(c[1]) && isFinite(c[2]) && isFinite(c[3]) && !ee(c, this.maxSourceExtent_))
27179      return;
27180    let _ = 0;
27181    if (!g && (!isFinite(r[0]) || !isFinite(r[1]) || !isFinite(o[0]) || !isFinite(o[1]) || !isFinite(a[0]) || !isFinite(a[1]) || !isFinite(l[0]) || !isFinite(l[1]))) {
27182      if (h > 0)
27183        g = !0;
27184      else if (_ = (!isFinite(r[0]) || !isFinite(r[1]) ? 8 : 0) + (!isFinite(o[0]) || !isFinite(o[1]) ? 4 : 0) + (!isFinite(a[0]) || !isFinite(a[1]) ? 2 : 0) + (!isFinite(l[0]) || !isFinite(l[1]) ? 1 : 0), _ != 1 && _ != 2 && _ != 4 && _ != 8)
27185        return;
27186    }
27187    if (h > 0) {
27188      if (!g) {
27189        const m = [(t[0] + s[0]) / 2, (t[1] + s[1]) / 2], p = this.transformInv_(m);
27190        let y;
27191        f ? y = ($i(r[0], d) + $i(a[0], d)) / 2 - $i(p[0], d) : y = (r[0] + a[0]) / 2 - p[0];
27192        const v = (r[1] + a[1]) / 2 - p[1];
27193        g = y * y + v * v > this.errorThresholdSquared_;
27194      }
27195      if (g) {
27196        if (Math.abs(t[0] - s[0]) <= Math.abs(t[1] - s[1])) {
27197          const m = [(i[0] + s[0]) / 2, (i[1] + s[1]) / 2], p = this.transformInv_(m), y = [(n[0] + t[0]) / 2, (n[1] + t[1]) / 2], v = this.transformInv_(y);
27198          this.addQuad_(
27199            t,
27200            i,
27201            m,
27202            y,
27203            r,
27204            o,
27205            p,
27206            v,
27207            h - 1
27208          ), this.addQuad_(
27209            y,
27210            m,
27211            s,
27212            n,
27213            v,
27214            p,
27215            a,
27216            l,
27217            h - 1
27218          );
27219        } else {
27220          const m = [(t[0] + i[0]) / 2, (t[1] + i[1]) / 2], p = this.transformInv_(m), y = [(s[0] + n[0]) / 2, (s[1] + n[1]) / 2], v = this.transformInv_(y);
27221          this.addQuad_(
27222            t,
27223            m,
27224            y,
27225            n,
27226            r,
27227            p,
27228            v,
27229            l,
27230            h - 1
27231          ), this.addQuad_(
27232            m,
27233            i,
27234            s,
27235            y,
27236            p,
27237            o,
27238            a,
27239            v,
27240            h - 1
27241          );
27242        }
27243        return;
27244      }
27245    }
27246    if (f) {
27247      if (!this.canWrapXInSource_)
27248        return;
27249      this.wrapsXInSource_ = !0;
27250    }
27251    _ & 11 || this.addTriangle_(t, s, n, r, a, l), _ & 14 || this.addTriangle_(t, s, i, r, a, o), _ && (_ & 13 || this.addTriangle_(i, n, t, o, l, r), _ & 7 || this.addTriangle_(i, n, s, o, l, a));
27252  }
27253  /**
27254   * Calculates extent of the `source` coordinates from all the triangles.
27255   *
27256   * @return {import("../extent.js").Extent} Calculated extent.
27257   */
27258  calculateSourceExtent() {
27259    const t = ve();
27260    return this.triangles_.forEach(function(i, s, n) {
27261      const r = i.source;
27262      qn(t, r[0]), qn(t, r[1]), qn(t, r[2]);
27263    }), t;
27264  }
27265  /**
27266   * @return {Array<Triangle>} Array of the calculated triangles.
27267   */
27268  getTriangles() {
27269    return this.triangles_;
27270  }
27271}
27272const Zg = Aw;
27273let Qa;
27274const dn = [];
27275function hd(e, t, i, s, n) {
27276  e.beginPath(), e.moveTo(0, 0), e.lineTo(t, i), e.lineTo(s, n), e.closePath(), e.save(), e.clip(), e.fillRect(0, 0, Math.max(t, s) + 1, Math.max(i, n)), e.restore(
27276);
27277}
27278function tl(e, t) {
27279  return Math.abs(e[t * 4] - 210) > 2 || Math.abs(e[t * 4 + 3] - 0.75 * 255) > 2;
27280}
27281function Lw() {
27282  if (Qa === void 0) {
27283    const e = re(6, 6, dn);
27284    e.globalCompositeOperation = "lighter", e.fillStyle = "rgba(210, 0, 0, 0.75)", hd(e, 4, 5, 4, 0), hd(e, 4, 5, 0, 5);
27285    const t = e.getImageData(0, 0, 3, 3).data;
27286    Qa = tl(t, 0) || tl(t, 4) || tl(t, 8), pa(e), dn.push(e.canvas);
27287  }
27288  return Qa;
27289}
27290function vr(e, t, i, s) {
27291  const n = Jo(i, t, e);
27292  let r = Dc(
27293    t,
27294    s,
27295    i
27296  );
27297  const o = t.getMetersPerUnit();
27298  o !== void 0 && (r *= o);
27299  const a = e.getMetersPerUnit();
27300  a !== void 0 && (r /= a);
27301  const l = e.getExtent();
27302  if (!l || Rr(l, n)) {
27303    const h = Dc(e, r, n) / r;
27304    isFinite(h) && h > 0 && (r /= h);
27305  }
27306  return r;
27307}
27308function Ow(e, t, i, s) {
27309  const n = ii(i);
27310  let r = vr(
27311    e,
27312    t,
27313    n,
27314    s
27315  );
27316  return (!isFinite(r) || r <= 0) && Hl(i, function(o) {
27317    return r = vr(
27318      e,
27319      t,
27320      o,
27321      s
27322    ), isFinite(r) && r > 0;
27323  }), r;
27324}
27325function Jg(e, t, i, s, n, r, o, a, l, h, c, u) {
27326  const d = re(
27327    Math.round(i * e),
27328    Math.round(i * t),
27329    dn
27330  );
27331  if (u || (d.imageSmoothingEnabled = !1), l.length === 0)
27332    return d.canvas;
27333  d.scale(i, i);
27334  function f(E) {
27335    return Math.round(E * i) / i;
27336  }
27337  d.globalCompositeOperation = "lighter";
27338  const g = ve();
27339  l.forEach(function(E, C, w) {
27340    jd(g, E.extent);
27341  });
27342  const _ = mt(g), m = Yt(g), p = re(
27343    Math.round(i * _ / s),
27344    Math.round(i * m / s),
27345    dn
27346  );
27347  u || (p.imageSmoothingEnabled = !1);
27348  const y = i / s;
27349  l.forEach(function(E, C, w) {
27350    const O = E.extent[0] - g[0], R = -(E.extent[3] - g[3]), j = mt(E.extent), $ = Yt(E.extent);
27351    E.image.width > 0 && E.image.height > 0 && p.drawImage(
27352      E.image,
27353      h,
27354      h,
27355      E.image.width - 2 * h,
27356      E.image.height - 2 * h,
27357      O * y,
27358      R * y,
27359      j * y,
27360      $ * y
27361    );
27362  });
27363  const v = Rs(o);
27364  return a.getTriangles().forEach(function(E, C, w) {
27365    const O = E.source, R = E.target;
27366    let j = O[0][0], $ = O[0][1], V = O[1][0], tt = O[1][1], J = O[2][0], St = O[2][1];
27367    const K = f((R[0][0] - v[0]) / r), Y = f(
27368      -(R[0][1] - v[1]) / r
27369    ), L = f((R[1][0] - v[0]) / r), W = f(
27370      -(R[1][1] - v[1]) / r
27371    ), ut = f((R[2][0] - v[0]) / r), ft = f(
27372      -(R[2][1] - v[1]) / r
27373    ), Tt = j, I = $;
27374    j = 0, $ = 0, V -= Tt, tt -= I, J -= Tt, St -= I;
27375    const Vt = [
27376      [V, tt, 0, 0, L - K],
27377      [J, St, 0, 0, ut - K],
27378      [0, 0, V, tt, W - Y],
27379      [0, 0, J, St, ft - Y]
27380    ], pt = r1(Vt);
27381    if (pt) {
27382      if (d.save(), d.beginPath(), Lw() || !u) {
27383        d.moveTo(L, W);
27384        const vt = 4, Bt = K - L, oe = Y - W;
27385        for (let Gt = 0; Gt < vt; Gt++)
27386          d.lineTo(
27387            L + f((Gt + 1) * Bt / vt),
27388            W + f(Gt * oe / (vt - 1))
27389          ), Gt != vt - 1 && d.lineTo(
27390            L + f((Gt + 1) * Bt / vt),
27391            W + f((Gt + 1) * oe / (vt - 1))
27392          );
27393        d.lineTo(ut, ft);
27394      } else
27395        d.moveTo(L, W), d.lineTo(K, Y), d.lineTo(ut, ft);
27396      d.clip(), d.transform(
27397        pt[0],
27398        pt[2],
27399        pt[1],
27400        pt[3],
27401        K,
27402        Y
27403      ), d.translate(
27404        g[0] - Tt,
27405        g[3] - I
27406      ), d.scale(
27407        s / i,
27408        -s / i
27409      ), d.drawImage(p.canvas, 0, 0), d.restore();
27410    }
27411  }), pa(p), dn.push(p.canvas), c && (d.save(), d.globalCompositeOperation = "source-over", d.strokeStyle = "black", d.lineWidth = 1, a.getTriangles().forEac
27411h(function(E, C, w) {
27412    const O = E.target, R = (O[0][0] - v[0]) / r, j = -(O[0][1] - v[1]) / r, $ = (O[1][0] - v[0]) / r, V = -(O[1][1] - v[1]) / r, tt = (O[2][0] - v[0]) / r, J = -(O[2][1] - v[1]) / r;
27413    d.beginPath(), d.moveTo($, V), d.lineTo(R, j), d.lineTo(tt, J), d.closePath(), d.stroke();
27414  }), d.restore()), d.canvas;
27415}
27416class Fw extends Ag {
27417  /**
27418   * @param {import("../proj/Projection.js").default} sourceProj Source projection (of the data).
27419   * @param {import("../proj/Projection.js").default} targetProj Target projection.
27420   * @param {import("../extent.js").Extent} targetExtent Target extent.
27421   * @param {number} targetResolution Target resolution.
27422   * @param {number} pixelRatio Pixel ratio.
27423   * @param {FunctionType} getImageFunction
27424   *     Function returning source images (extent, resolution, pixelRatio).
27425   * @param {boolean} interpolate Use linear interpolation when resampling.
27426   */
27427  constructor(t, i, s, n, r, o, a) {
27428    let l = t.getExtent();
27429    l && t.canWrapX() && (l = l.slice(), l[0] = -1 / 0, l[2] = 1 / 0);
27430    let h = i.getExtent();
27431    h && i.canWrapX() && (h = h.slice(), h[0] = -1 / 0, h[2] = 1 / 0);
27432    const c = h ? gs(s, h) : s, u = ii(c), d = vr(
27433      t,
27434      i,
27435      u,
27436      n
27437    ), f = Hg, g = new Zg(
27438      t,
27439      i,
27440      c,
27441      l,
27442      d * f,
27443      n
27444    ), _ = g.calculateSourceExtent(), m = Is(_) ? null : o(_, d, r), p = m ? rt.IDLE : rt.EMPTY, y = m ? m.getPixelRatio() : 1;
27445    super(s, n, y, p), this.targetProj_ = i, this.maxSourceExtent_ = l, this.triangulation_ = g, this.targetResolution_ = n, this.targetExtent_ = s, this.sourceImage_ = m, this.sourcePixelRatio_ = y, this.interpolate_ = a, this.canvas_ = null, this.sourceListenerKey_ = null;
27446  }
27447  /**
27448   * Clean up.
27449   */
27450  disposeInternal() {
27451    this.state == rt.LOADING && this.unlistenSource_(), super.disposeInternal();
27452  }
27453  /**
27454   * @return {HTMLCanvasElement} Image.
27455   */
27456  getImage() {
27457    return this.canvas_;
27458  }
27459  /**
27460   * @return {import("../proj/Projection.js").default} Projection.
27461   */
27462  getProjection() {
27463    return this.targetProj_;
27464  }
27465  /**
27466   * @private
27467   */
27468  reproject_() {
27469    const t = this.sourceImage_.getState();
27470    if (t == rt.LOADED) {
27471      const i = mt(this.targetExtent_) / this.targetResolution_, s = Yt(this.targetExtent_) / this.targetResolution_;
27472      this.canvas_ = Jg(
27473        i,
27474        s,
27475        this.sourcePixelRatio_,
27476        this.sourceImage_.getResolution(),
27477        this.maxSourceExtent_,
27478        this.targetResolution_,
27479        this.targetExtent_,
27480        this.triangulation_,
27481        [
27482          {
27483            extent: this.sourceImage_.getExtent(),
27484            image: this.sourceImage_.getImage()
27485          }
27486        ],
27487        0,
27488        void 0,
27489        this.interpolate_
27490      );
27491    }
27492    this.state = t, this.changed();
27493  }
27494  /**
27495   * Load not yet loaded URI.
27496   */
27497  load() {
27498    if (this.state == rt.IDLE) {
27499      this.state = rt.LOADING, this.changed();
27500      const t = this.sourceImage_.getState();
27501      t == rt.LOADED || t == rt.ERROR ? this.reproject_() : (this.sourceListenerKey_ = lt(
27502        this.sourceImage_,
27503        et.CHANGE,
27504        function(i) {
27505          const s = this.sourceImage_.getState();
27506          (s == rt.LOADED || s == rt.ERROR) && (this.unlistenSource_(), this.reproject_());
27507        },
27508        this
27509      ), this.sourceImage_.load());
27510    }
27511  }
27512  /**
27513   * @private
27514   */
27515  unlistenSource_() {
27516    Mt(
27517      /** @type {!import("../events.js").EventsKey} */
27518      this.sourceListenerKey_
27519    ), this.sourceListenerKey_ = null;
27520  }
27521}
27522const kw = Fw, el = {
27523  /**
27524   * Triggered when an image starts loading.
27525   * @event module:ol/source/Image.ImageSourceEvent#imageloadstart
27526   * @api
27527   */
27528  IMAGELOADSTART: "imageloadstart",
27529  /**
27530   * Triggered when an image finishes loading.
27531   * @event module:ol/source/Image.ImageSourceEvent#imageloadend
27532   * @api
27533   */
27534  IMAGELOADEND: "imageloadend",
27535  /**
27536   * Triggered if image loading results in an error.
27537   * @event module:ol/source/Image.ImageSourceEvent#imageloaderror
27538   * @api
27539   */
27540  IMAGELOADERROR: "imageloaderror"
27541};
27542class Dw extends Ae {
27543  /**
27544   * @param {string} type Type.
27545   * @param {import("../Image.js").default} image The image.
27546   */
27547  constructor(t, i) {
27548    super(t), this.image = i;
27549  }
27550}
27551class Nw extends ic {
27552  /**
27553   * @param {Options} options Single image source options.
27554   */
27555  constructor(t) {
27556    super({
27557      attributions: t.attributions,
27558      projection: t.projection,
27559      state: t.state,
27560      interpolate: t.interpolate !== void 0 ? t.interpolate : !0
27561    }), this.on, this.once, this.un, this.resolutions_ = t.resolutions !== void 0 ? t.resolutions : null, this.reprojectedImage_ = null, this.reprojectedRevision_ = 0;
27562  }
27563  /**
27564   * @return {Array<number>|null} Resolutions.
27565   */
27566  getResolutions() {
27567    return this.resolutions_;
27568  }
27569  /**
27570   * @param {Array<number>|null} resolutions Resolutions.
27571   */
27572  setResolutions(t) {
27573    this.resolutions_ = t;
27574  }
27575  /**
27576   * @protected
27577   * @param {number} resolution Resolution.
27578   * @return {number} Resolution.
27579   */
27580  findNearestResolution(t) {
27581    const i = this.getResolutions();
27582    if (i) {
27583      const s = ua(i, t, 0);
27584      t = i[s];
27585    }
27586    return t;
27587  }
27588  /**
27589   * @param {import("../extent.js").Extent} extent Extent.
27590   * @param {number} resolution Resolution.
27591   * @param {number} pixelRatio Pixel ratio.
27592   * @param {import("../proj/Projection.js").default} projection Projection.
27593   * @return {import("../ImageBase.js").default} Single image.
27594   */
27595  getImage(t, i, s, n) {
27596    const r = this.getProjection();
27597    if (!r || !n || di(r, n))
27598      return r && (n = r), this.getImageInternal(t, i, s, n);
27599    if (this.reprojectedImage_) {
27600      if (this.reprojectedRevision_ == this.getRevision() && di(this.reprojectedImage_.getProjection(), n) && this.reprojectedImage_.getResolution() == i && pn(this.reprojectedImage_.getExtent(), t))
27601        return this.reprojectedImage_;
27602      this.reprojectedImage_.dispose(), this.reprojectedImage_ = null;
27603    }
27604    return this.reprojectedImage_ = new kw(
27605      r,
27606      n,
27607      t,
27608      i,
27609      s,
27610      (o, a, l) => this.getImageInternal(o, a, l, r),
27611      this.getInterpolate()
27612    ), this.reprojectedRevision_ = this.getRevision(), this.reprojectedImage_;
27613  }
27614  /**
27615   * @abstract
27616   * @param {import("../extent.js").Extent} extent Extent.
27617   * @param {number} resolution Resolution.
27618   * @param {number} pixelRatio Pixel ratio.
27619   * @param {import("../proj/Projection.js").default} projection Projection.
27620   * @return {import("../ImageBase.js").default} Single image.
27621   * @protected
27622   */
27623  getImageInternal(t, i, s, n) {
27624    return Z();
27625  }
27626  /**
27627   * Handle image change events.
27628   * @param {import("../events/Event.js").default} event Event.
27629   * @protected
27630   */
27631  handleImageChange(t) {
27632    const i = (
27633      /** @type {import("../Image.js").default} */
27634      t.target
27635    );
27636    let s;
27637    switch (i.getState()) {
27638      case rt.LOADING:
27639        this.loading = !0, s = el.IMAGELOADSTART;
27640        break;
27641      case rt.LOADED:
27642        this.loading = !1, s = el.IMAGELOADEND;
27643        break;
27644      case rt.ERROR:
27645        this.loading = !1, s = el.IMAGELOADERROR;
27646        break;
27647      default:
27648        return;
27649    }
27650    this.hasListener(s) && this.dispatchEvent(new Dw(s, i));
27651  }
27652}
27653function Gw(e, t) {
27654  e.getImage().src = t;
27655}
27656const zw = Nw, Ui = "1.3.0";
27657function Yo(e, t) {
27658  const i = [];
27659  Object.keys(t).forEach(function(n) {
27660    t[n] !== null && t[n] !== void 0 && i.push(n + "=" + encodeURIComponent(t[n]));
27661  });
27662  const s = i.join("&");
27663  return e = e.replace(/[?&]$/, ""), e += e.includes("?") ? "&" : "?", e + s;
27664}
27665const Ai = 4, cd = [101, 101];
27666class jw extends zw {
27667  /**
27668   * @param {Options} [options] ImageWMS options.
27669   */
27670  constructor(t) {
27671    t = t || {}, super({
27672      attributions: t.attributions,
27673      interpolate: t.interpolate,
27674      projection: t.projection,
27675      resolutions: t.resolutions
27676    }), this.context_ = re(1, 1), this.crossOrigin_ = t.crossOrigin !== void 0 ? t.crossOrigin : null, this.url_ = t.url, this.imageLoadFunction_ = t.imageLoadFunction !== void 0 ? t.imageLoadFunction : Gw, this.params_ = Object.assign({}, t.params), this.v13_ = !0, this.updateV13_(), this.serverType_ = t.serverType, this.hidpi_ = t.hidpi !== void 0 ? t.hidpi : !0, this.image_ = null, this.imageSize_ = [0, 0], this.renderedRevision_ = 0, this.ratio_ = t.ratio !== void 0 ? t.ratio : 1.5;
27677  }
27678  /**
27679   * Return the GetFeatureInfo URL for the passed coordinate, resolution, and
27680   * projection. Return `undefined` if the GetFeatureInfo URL cannot be
27681   * constructed.
27682   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
27683   * @param {number} resolution Resolution.
27684   * @param {import("../proj.js").ProjectionLike} projection Projection.
27685   * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
27686   *     be provided. If `QUERY_LAYERS` is not provided then the layers specified
27687   *     in the `LAYERS` parameter will be used. `VERSION` should not be
27688   *     specified here.
27689   * @return {string|undefined} GetFeatureInfo URL.
27690   * @api
27691   */
27692  getFeatureInfoUrl(t, i, s, n) {
27693    if (this.url_ === void 0)
27694      return;
27695    const r = Rt(s), o = this.getProjection();
27696    o && o !== r && (i = vr(
27697      o,
27698      r,
27699      t,
27700      i
27701    ), t = Jo(t, r, o));
27702    const a = on(
27703      t,
27704      i,
27705      0,
27706      cd
27707    ), l = {
27708      SERVICE: "WMS",
27709      VERSION: Ui,
27710      REQUEST: "GetFeatureInfo",
27711      FORMAT: "image/png",
27712      TRANSPARENT: !0,
27713      QUERY_LAYERS: this.params_.LAYERS
27714    };
27715    Object.assign(l, this.params_, n);
27716    const h = Js((t[0] - a[0]) / i, Ai), c = Js((a[3] - t[1]) / i, Ai);
27717    return l[this.v13_ ? "I" : "X"] = h, l[this.v13_ ? "J" : "Y"] = c, this.getRequestUrl_(
27718      a,
27719      cd,
27720      1,
27721      o || r,
27722      l
27723    );
27724  }
27725  /**
27726   * Return the GetLegendGraphic URL, optionally optimized for the passed
27727   * resolution and possibly including any passed specific parameters. Returns
27728   * `undefined` if the GetLegendGraphic URL cannot be constructed.
27729   *
27730   * @param {number} [resolution] Resolution. If set to undefined, `SCALE`
27731   *     will not be calculated and included in URL.
27732   * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the
27733   *     request is generated for this wms layer, else it will try to use the
27734   *     configured wms layer. Default `FORMAT` is `image/png`.
27735   *     `VERSION` should not be specified here.
27736   * @return {string|undefined} GetLegendGraphic URL.
27737   * @api
27738   */
27739  getLegendUrl(t, i) {
27740    if (this.url_ === void 0)
27741      return;
27742    const s = {
27743      SERVICE: "WMS",
27744      VERSION: Ui,
27745      REQUEST: "GetLegendGraphic",
27746      FORMAT: "image/png"
27747    };
27748    if (i === void 0 || i.LAYER === void 0) {
27749      const n = this.params_.LAYERS;
27750      if (!(!Array.isArray(n) || n.length === 1))
27751        return;
27752      s.LAYER = n;
27753    }
27754    if (t !== void 0) {
27755      const n = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1, r = 28e-5;
27756      s.SCALE = t * n / r;
27757    }
27758    return Object.assign(s, i), Yo(
27759      /** @type {string} */
27760      this.url_,
27761      s
27762    );
27763  }
27764  /**
27765   * Get the user-provided params, i.e. those passed to the constructor through
27766   * the "params" option, and possibly updated using the updateParams method.
27767   * @return {Object} Params.
27768   * @api
27769   */
27770  getParams() {
27771    return this.params_;
27772  }
27773  /**
27774   * @param {import("../extent.js").Extent} extent Extent.
27775   * @param {number} resolution Resolution.
27776   * @param {number} pixelRatio Pixel ratio.
27777   * @param {import("../proj/Projection.js").default} projection Projection.
27778   * @return {import("../Image.js").default} Single image.
27779   */
27780  getImageInternal(t, i, s, n) {
27781    if (this.url_ === void 0)
27782      return null;
27783    i = this.findNearestResolution(i), s != 1 && (!this.hidpi_ || this.serverType_ === void 0) && (s = 1);
27784    const r = i / s, o = ii(t), a = zi(mt(t) / r, Ai), l = zi(Yt(t) / r, Ai), h = on(o, r, 0, [
27785      a,
27786      l
27787    ]), c = zi(
27788      this.ratio_ * mt(t) / r,
27789      Ai
27790    ), u = zi(
27791      this.ratio_ * Yt(t) / r,
27792      Ai
27793    ), d = on(o, r, 0, [
27794      c,
27795      u
27796    ]), f = this.image_;
27797    if (f && this.renderedRevision_ == this.getRevision() && f.getResolution() == i && f.getPixelRatio() == s && Gi(f.getExtent(), h))
27798      return f;
27799    const g = {
27800      SERVICE: "WMS",
27801      VERSION: Ui,
27802      REQUEST: "GetMap",
27803      FORMAT: "image/png",
27804      TRANSPARENT: !0
27805    };
27806    Object.assign(g, this.params_), this.imageSize_[0] = Fc(
27807      mt(d) / r,
27808      Ai
27809    ), this.imageSize_[1] = Fc(
27810      Yt(d) / r,
27811      Ai
27812    );
27813    const _ = this.getRequestUrl_(
27814      d,
27815      this.imageSize_,
27816      s,
27817      n,
27818      g
27819    );
27820    return this.image_ = new DC(
27821      d,
27822      i,
27823      s,
27824      _,
27825      this.crossOrigin_,
27826      this.imageLoadFunction_,
27827      this.context_
27828    ), this.renderedRevision_ = this.getRevision(), this.image_.addEventListener(
27829      et.CHANGE,
27830      this.handleImageChange.bind(this)
27831    ), this.image_;
27832  }
27833  /**
27834   * Return the image load function of the source.
27835   * @return {import("../Image.js").LoadFunction} The image load function.
27836   * @api
27837   */
27838  getImageLoadFunction() {
27839    return this.imageLoadFunction_;
27840  }
27841  /**
27842   * @param {import("../extent.js").Extent} extent Extent.
27843   * @param {import("../size.js").Size} size Size.
27844   * @param {number} pixelRatio Pixel ratio.
27845   * @param {import("../proj/Projection.js").default} projection Projection.
27846   * @param {Object} params Params.
27847   * @return {string} Request URL.
27848   * @private
27849   */
27850  getRequestUrl_(t, i, s, n, r) {
27851    if (at(this.url_ !== void 0, 9), r[this.v13_ ? "CRS" : "SRS"] = n.getCode(), "
27851STYLES" in this.params_ || (r.STYLES = ""), s != 1)
27852      switch (this.serverType_) {
27853        case "geoserver":
27854          const l = 90 * s + 0.5 | 0;
27855          "FORMAT_OPTIONS" in r ? r.FORMAT_OPTIONS += ";dpi:" + l : r.FORMAT_OPTIONS = "dpi:" + l;
27856          break;
27857        case "mapserver":
27858          r.MAP_RESOLUTION = 90 * s;
27859          break;
27860        case "carmentaserver":
27861        case "qgis":
27862          r.DPI = 90 * s;
27863          break;
27864        default:
27865          at(!1, 8);
27866          break;
27867      }
27868    r.WIDTH = i[0], r.HEIGHT = i[1];
27869    const o = n.getAxisOrientation();
27870    let a;
27871    return this.v13_ && o.substr(0, 2) == "ne" ? a = [t[1], t[0], t[3], t[2]] : a = t, r.BBOX = a.join(","), Yo(
27872      /** @type {string} */
27873      this.url_,
27874      r
27875    );
27876  }
27877  /**
27878   * Return the URL used for this WMS source.
27879   * @return {string|undefined} URL.
27880   * @api
27881   */
27882  getUrl() {
27883    return this.url_;
27884  }
27885  /**
27886   * Set the image load function of the source.
27887   * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
27888   * @api
27889   */
27890  setImageLoadFunction(t) {
27891    this.image_ = null, this.imageLoadFunction_ = t, this.changed();
27892  }
27893  /**
27894   * Set the URL to use for requests.
27895   * @param {string|undefined} url URL.
27896   * @api
27897   */
27898  setUrl(t) {
27899    t != this.url_ && (this.url_ = t, this.image_ = null, this.changed());
27900  }
27901  /**
27902   * Update the user-provided params.
27903   * @param {Object} params Params.
27904   * @api
27905   */
27906  updateParams(t) {
27907    Object.assign(this.params_, t), this.updateV13_(), this.image_ = null, this.changed();
27908  }
27909  /**
27910   * @private
27911   */
27912  updateV13_() {
27913    const t = this.params_.VERSION || Ui;
27914    this.v13_ = Ud(t, "1.3") >= 0;
27915  }
27916}
27917const Ww = jw;
27918class Bw extends Dg {
27919  /**
27920   * @param {import("../proj/Projection.js").default} sourceProj Source projection.
27921   * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
27922   * @param {import("../proj/Projection.js").default} targetProj Target projection.
27923   * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid.
27924   * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile.
27925   * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
27926   * @param {number} pixelRatio Pixel ratio.
27927   * @param {number} gutter Gutter of the source tiles.
27928   * @param {FunctionType} getTileFunction
27929   *     Function returning source tiles (z, x, y, pixelRatio).
27930   * @param {number} [errorThreshold] Acceptable reprojection error (in px).
27931   * @param {boolean} [renderEdges] Render reprojection edges.
27932   * @param {boolean} [interpolate] Use linear interpolation when resampling.
27933   */
27934  constructor(t, i, s, n, r, o, a, l, h, c, u, d) {
27935    super(r, H.IDLE, { interpolate: !!d }), this.renderEdges_ = u !== void 0 ? u : !1, this.pixelRatio_ = a, this.gutter_ = l, this.canvas_ = null, this.sourceTileGrid_ = i, this.targetTileGrid_ = n, this.wrappedTileCoord_ = o || r, this.sourceTiles_ = [], this.sourcesListenerKeys_ = null, this.sourceZ_ = 0;
27936    const f = n.getTileCoordExtent(
27937      this.wrappedTileCoord_
27938    ), g = this.targetTileGrid_.getExtent();
27939    let _ = this.sourceTileGrid_.getExtent();
27940    const m = g ? gs(f, g) : f;
27941    if (hl(m) === 0) {
27942      this.state = H.EMPTY;
27943      return;
27944    }
27945    const p = t.getExtent();
27946    p && (_ ? _ = gs(_, p) : _ = p);
27947    const y = n.getResolution(
27948      this.wrappedTileCoord_[0]
27949    ), v = Ow(
27950      t,
27951      s,
27952      m,
27953      y
27954    );
27955    if (!isFinite(v) || v <= 0) {
27956      this.state = H.EMPTY;
27957      return;
27958    }
27959    const E = c !== void 0 ? c : Hg;
27960    if (this.triangulation_ = new Zg(
27961      t,
27962      s,
27963      m,
27964      _,
27965      v * E,
27966      y
27967    ), this.triangulation_.getTriangles().length === 0) {
27968      this.state = H.EMPTY;
27969      return;
27970    }
27971    this.sourceZ_ = i.getZForResolution(v);
27972    let C = this.triangulation_.calculateSourceExtent();
27973    if (_ && (t.canWrapX() ? (C[1] = Ot(
27974      C[1],
27975      _[1],
27976      _[3]
27977    ), C[3] = Ot(
27978      C[3],
27979      _[1],
27980      _[3]
27981    )) : C = gs(C, _)), !hl(C))
27982      this.state = H.EMPTY;
27983    else {
27984      const w = i.getTileRangeForExtentAndZ(
27985        C,
27986        this.sourceZ_
27987      );
27988      for (let O = w.minX; O <= w.maxX; O++)
27989        for (let R = w.minY; R <= w.maxY; R++) {
27990          const j = h(this.sourceZ_, O, R, a);
27991          j && this.sourceTiles_.push(j);
27992        }
27993      this.sourceTiles_.length === 0 && (this.state = H.EMPTY);
27994    }
27995  }
27996  /**
27997   * Get the HTML Canvas element for this tile.
27998   * @return {HTMLCanvasElement} Canvas.
27999   */
28000  getImage() {
28001    return this.canvas_;
28002  }
28003  /**
28004   * @private
28005   */
28006  reproject_() {
28007    const t = [];
28008    if (this.sourceTiles_.forEach((i) => {
28009      i && i.getState() == H.LOADED && t.push({
28010        extent: this.sourceTileGrid_.getTileCoordExtent(i.tileCoord),
28011        image: i.getImage()
28012      });
28013    }), this.sourceTiles_.length = 0, t.length === 0)
28014      this.state = H.ERROR;
28015    else {
28016      const i = this.wrappedTileCoord_[0], s = this.targetTileGrid_.getTileSize(i), n = typeof s == "number" ? s : s[0], r = typeof s == "number" ? s : s[1], o = this.targetTileGrid_.getResolution(i), a = this.sourceTileGrid_.getResolution(
28017        this.sourceZ_
28018      ), l = this.targetTileGrid_.getTileCoordExtent(
28019        this.wrappedTileCoord_
28020      );
28021      this.canvas_ = Jg(
28022        n,
28023        r,
28024        this.pixelRatio_,
28025        a,
28026        this.sourceTileGrid_.getExtent(),
28027        o,
28028        l,
28029        this.triangulation_,
28030        t,
28031        this.gutter_,
28032        this.renderEdges_,
28033        this.interpolate
28034      ), this.state = H.LOADED;
28035    }
28036    this.changed();
28037  }
28038  /**
28039   * Load not yet loaded URI.
28040   */
28041  load() {
28042    if (this.state == H.IDLE) {
28043      this.state = H.LOADING, this.changed();
28044      let t = 0;
28045      this.sourcesListenerKeys_ = [], this.sourceTiles_.forEach((i) => {
28046        const s = i.getState();
28047        if (s == H.IDLE || s == H.LOADING) {
28048          t++;
28049          const n = lt(
28050            i,
28051            et.CHANGE,
28052            function(r) {
28053              const o = i.getState();
28054              (o == H.LOADED || o == H.ERROR || o == H.EMPTY) && (Mt(n), t--, t === 0 && (this.unlistenSources_(), this.reproject_()));
28055            },
28056            this
28057          );
28058          this.sourcesListenerKeys_.push(n);
28059        }
28060      }), t === 0 ? setTimeout(this.reproject_.bind(this), 0) : this.sourceTiles_.forEach(function(i, s, n) {
28061        i.getState() == H.IDLE && i.load();
28062      });
28063    }
28064  }
28065  /**
28066   * @private
28067   */
28068  unlistenSources_() {
28069    this.sourcesListenerKeys_.forEach(Mt), this.sourcesListenerKeys_ = null;
28070  }
28071  /**
28072   * Remove from the cache due to expiry
28073   */
28074  release() {
28075    this.canvas_ && (pa(this.canvas_.getContext("2d")), dn.push(this.canvas_), this.canvas_ = null), super.release();
28076  }
28077}
28078const zl = Bw, il = {
28079  /**
28080   * Triggered when a tile starts loading.
28081   * @event module:ol/source/Tile.TileSourceEvent#tileloadstart
28082   * @api
28083   */
28084  TILELOADSTART: "tileloadstart",
28085  /**
28086   * Triggered when a tile finishes loading, either when its data is loaded,
28087   * or when loading was aborted because the tile is no longer needed.
28088   * @event module:ol/source/Tile.TileSourceEvent#tileloadend
28089   * @api
28090   */
28091  TILELOADEND: "tileloadend",
28092  /**
28093   * Triggered if tile loading results in an error. Note that this is not the
28094   * right place to re-fetch tiles. See {@link module:ol/ImageTile~ImageTile#load}
28095   * for details.
28096   * @event module:ol/source/Tile.TileSourceEvent#tileloaderror
28097   * @api
28098   */
28099  TILELOADERROR: "tileloaderror"
28100}, Ws = [0, 0, 0], Li = 5;
28101class Uw {
28102  /**
28103   * @param {Options} options Tile grid options.
28104   */
28105  constructor(t) {
28106    this.minZoom = t.minZoom !== void 0 ? t.minZoom : 0, this.resolutions_ = t.resolutions, at(
28107      rE(
28108        this.resolutions_,
28109        function(n, r) {
28110          return r - n;
28111        },
28112        !0
28113      ),
28114      17
28115    );
28116    let i;
28117    if (!t.origins) {
28118      for (let n = 0, r = this.resolutions_.length - 1; n < r; ++n)
28119        if (!i)
28120          i = this.resolutions_[n] / this.resolutions_[n + 1];
28121        else if (this.resolutions_[n] / this.resolutions_[n + 1] !== i) {
28122          i = void 0;
28123          break;
28124        }
28125    }
28126    this.zoomFactor_ = i, this.maxZoom = this.resolutions_.length - 1, this.origin_ = t.origin !== void 0 ? t.origin : null, this.origins_ = null, t.origins !== void 0 && (this.origins_ = t.origins, at(this.origins_.length == this.resolutions_.length, 20));
28127    const s = t.extent;
28128    s !== void 0 && !this.origin_ && !this.origins_ && (this.origin_ = Rs(s)), at(
28129      !this.origin_ && this.origins_ || this.origin_ && !this.origins_,
28130      18
28131    ), this.tileSizes_ = null, t.tileSizes !== void 0 && (this.tileSizes_ = t.tileSizes, at(this.tileSizes_.length == this.resolutions_.length, 19)), this.tileSize_ = t.tileSize !== void 0 ? t.tileSize : this.tileSizes_ ? null : Sh, at(
28132      !this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
28133      22
28134    ), this.extent_ = s !== void 0 ? s : null, this.fullTileRanges_ = null, this.tmpSize_ = [0, 0], this.tmpExtent_ = [0, 0, 0, 0], t.sizes !== void 0 ? this.fullTileRanges_ = t.sizes.map(function(n, r) {
28135      const o = new Bg(
28136        Math.min(0, n[0]),
28137        Math.max(n[0] - 1, -1),
28138        Math.min(0, n[1]),
28139        Math.max(n[1] - 1, -1)
28140      );
28141      if (s) {
28142        const a = this.getTileRangeForExtentAndZ(s, r);
28143        o.minX = Math.max(a.minX, o.minX), o.maxX = Math.min(a.maxX, o.maxX), o.minY = Math.max(a.minY, o.minY), o.maxY = Math.min(a.maxY, o.maxY);
28144      }
28145      return o;
28146    }, this) : s && this.calculateTileRanges_(s);
28147  }
28148  /**
28149   * Call a function with each tile coordinate for a given extent and zoom level.
28150   *
28151   * @param {import("../extent.js").Extent} extent Extent.
28152   * @param {number} zoom Integer zoom level.
28153   * @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
28154   * @api
28155   */
28156  forEachTileCoord(t, i, s) {
28157    const n = this.getTileRangeForExtentAndZ(t, i);
28158    for (let r = n.minX, o = n.maxX; r <= o; ++r)
28159      for (let a = n.minY, l = n.maxY; a <= l; ++a)
28160        s([i, r, a]);
28161  }
28162  /**
28163   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28164   * @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
28165   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
28166   * @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
28167   * @return {boolean} Callback succeeded.
28168   */
28169  forEachTileCoordParentTileRange(t, i, s, n) {
28170    let r, o, a, l = null, h = t[0] - 1;
28171    for (this.zoomFactor_ === 2 ? (o = t[1], a = t[2]) : l = this.getTileCoordExtent(t, n); h >= this.minZoom; ) {
28172      if (this.zoomFactor_ === 2 ? (o = Math.floor(o / 2), a = Math.floor(a / 2), r = js(o, o, a, a, s)) : r = this.getTileRangeForExtentAndZ(
28173        l,
28174        h,
28175        s
28176      ), i(h, r))
28177        return !0;
28178      --h;
28179    }
28180    return !1;
28181  }
28182  /**
28183   * Get the extent for this tile grid, if it was configured.
28184   * @return {import("../extent.js").Extent} Extent.
28185   * @api
28186   */
28187  getExtent() {
28188    return this.extent_;
28189  }
28190  /**
28191   * Get the maximum zoom level for the grid.
28192   * @return {number} Max zoom.
28193   * @api
28194   */
28195  getMaxZoom() {
28196    return this.maxZoom;
28197  }
28198  /**
28199   * Get the minimum zoom level for the grid.
28200   * @return {number} Min zoom.
28201   * @api
28202   */
28203  getMinZoom() {
28204    return this.minZoom;
28205  }
28206  /**
28207   * Get the origin for the grid at the given zoom level.
28208   * @param {number} z Integer zoom level.
28209   * @return {import("../coordinate.js").Coordinate} Origin.
28210   * @api
28211   */
28212  getOrigin(t) {
28213    return this.origin_ ? this.origin_ : this.origins_[t];
28214  }
28215  /**
28216   * Get the resolution for the given zoom level.
28217   * @param {number} z Integer zoom level.
28218   * @return {number} Resolution.
28219   * @api
28220   */
28221  getResolution(t) {
28222    return this.resolutions_[t];
28223  }
28224  /**
28225   * Get the list of resolutions for the tile grid.
28226   * @return {Array<number>} Resolutions.
28227   * @api
28228   */
28229  getResolutions() {
28230    return this.resolutions_;
28231  }
28232  /**
28233   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28234   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
28235   * @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
28236   * @return {import("../TileRange.js").default|null} Tile range.
28237   */
28238  getTileCoordChildTileRange(t, i, s) {
28239    if (t[0] < this.maxZoom) {
28240      if (this.zoomFactor_ === 2) {
28241        const r = t[1] * 2, o = t[2] * 2;
28242        return js(
28243          r,
28244          r + 1,
28245          o,
28246          o + 1,
28247          i
28248        );
28249      }
28250      const n = this.getTileCoordExtent(
28251        t,
28252        s || this.tmpExtent_
28253      );
28254      return this.getTileRangeForExtentAndZ(
28255        n,
28256        t[0] + 1,
28257        i
28258      );
28259    }
28260    return null;
28261  }
28262  /**
28263   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28264   * @param {number} z Integer zoom level.
28265   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
28266   * @return {import("../TileRange.js").default|null} Tile range.
28267   */
28268  getTileRangeForTileCoordAndZ(t, i, s) {
28269    if (i > this.maxZoom || i < this.minZoom)
28270      return null;
28271    const n = t[0], r = t[1], o = t[2];
28272    if (i === n)
28273      return js(
28274        r,
28275        o,
28276        r,
28277        o,
28278        s
28279      );
28280    if (this.zoomFactor_) {
28281      const l = Math.pow(this.zoomFactor_, i - n), h = Math.floor(r * l), c = Math.floor(o * l);
28282      if (i < n)
28283        return js(h, h, c, c, s);
28284      const u = Math.floor(l * (r + 1)) - 1, d = Math.floor(l * (o + 1)) - 1;
28285      return js(h, u, c, d, s);
28286    }
28287    const a = this.getTileCoordExtent(t, this.tmpExtent_);
28288    return this.getTileRangeForExtentAndZ(a, i, s);
28289  }
28290  /**
28291   * Get a tile range for the given extent and integer zoom level.
28292   * @param {import("../extent.js").Extent} extent Extent.
28293   * @param {number} z Integer zoom level.
28294   * @param {import("../TileRange.js").default} [tempTileRange] Temporary tile range object.
28295   * @return {import("../TileRange.js").default} Tile range.
28296   */
28297  getTileRangeForExtentAndZ(t, i, s) {
28298    this.getTileCoordForXYAndZ_(t[0], t[3], i, !1, Ws);
28299    const n = Ws[1], r = Ws[2];
28300    this.getTileCoordForXYAndZ_(t[2], t[1], i, !0, Ws);
28301    const o = Ws[1], a = Ws[2];
28302    return js(n, o, r, a, s);
28303  }
28304  /**
28305   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28306   * @return {import("../coordinate.js").Coordinate} Tile center.
28307   */
28308  getTileCoordCenter(t) {
28309    const i = this.getOrigin(t[0]), s = this.getResolution(t[0]), n = ye(this.getTileSize(t[0]), this.tmpSize_);
28310    return [
28311      i[0] + (t[1] + 0.5) * n[0] * s,
28312      i[1] - (t[2] + 0.5) * n[1] * s
28313    ];
28314  }
28315  /**
28316   * Get the extent of a tile coordinate.
28317   *
28318   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28319   * @param {import("../extent.js").Extent} [tempExtent] Temporary extent object.
28320   * @return {import("../extent.js").Extent} Extent.
28321   * @api
28322   */
28323  getTileCoordExtent(t, i) {
28324    const s = this.getOrigin(t[0]), n = this.getResolution(t[0]), r = ye(this.getTileSize(t[0]), this.tmpSize_), o = s[0] + t[1] * r[0] * n, a = s[1] - (t[2] + 1) * r[1] * n, l = o + r[0] * n, h = a + r[1] * n;
28325    return ei(o, a, l, h, i);
28326  }
28327  /**
28328   * Get the tile coordinate for the given map coordinate and resolution.  This
28329   * method considers that coordinates that intersect tile boundaries should be
28330   * assigned the higher tile coordinate.
28331   *
28332   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
28333   * @param {number} resolution Resolution.
28334   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
28335   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
28336   * @api
28337   */
28338  getTileCoordForCoordAndResolution(t, i, s) {
28339    return this.getTileCoordForXYAndResolution_(
28340      t[0],
28341      t[1],
28342      i,
28343      !1,
28344      s
28345    );
28346  }
28347  /**
28348   * Note that this method should not be called for resolutions that correspond
28349   * to an integer zoom level.  Instead call the `getTileCoordForXYAndZ_` method.
28350   * @param {number} x X.
28351   * @param {number} y Y.
28352   * @param {number} resolution Resolution (for a non-integer zoom level).
28353   * @param {boolean} reverseIntersectionPolicy Instead of letting edge
28354   *     intersections go to the higher tile coordinate, let edge intersections
28355   *     go to the lower tile coordinate.
28356   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
28357   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
28358   * @private
28359   */
28360  getTileCoordForXYAndResolution_(t, i, s, n, r) {
28361    const o = this.getZForResolution(s), a = s / this.getResolution(o), l = this.getOrigin(o), h = ye(this.getTileSize(o), this.tmpSize_);
28362    let c = a * (t - l[0]) / s / h[0], u = a * (l[1] - i) / s / h[1];
28363    return n ? (c = zi(c, Li) - 1, u = zi(u, Li) - 1) : (c = Js(c, Li), u = Js(u, Li)), Zu(o, c, u, r);
28364  }
28365  /**
28366   * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
28367   * they should have separate implementations.  This method is for integer zoom
28368   * levels.  The other method should only be called for resolutions corresponding
28369   * to non-integer zoom levels.
28370   * @param {number} x Map x coordinate.
28371   * @param {number} y Map y coordinate.
28372   * @param {number} z Integer zoom level.
28373   * @param {boolean} reverseIntersectionPolicy Instead of letting edge
28374   *     intersections go to the higher tile coordinate, let edge intersections
28375   *     go to the lower tile coordinate.
28376   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
28377   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
28378   * @private
28379   */
28380  getTileCoordForXYAndZ_(t, i, s, n, r) {
28381    const o = this.getOrigin(s), a = this.getResolution(s), l = ye(this.getTileSize(s), this.tmpSize_);
28382    let h = (t - o[0]) / a / l[0], c = (o[1] - i) / a / l[1];
28383    return n ? (h = zi(h, Li) - 1, c = zi(c, Li) - 1) : (h = Js(h, Li), c = Js(c, Li)), Zu(s, h, c, r);
28384  }
28385  /**
28386   * Get a tile coordinate given a map coordinate and zoom level.
28387   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
28388   * @param {number} z Zoom level.
28389   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
28390   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
28391   * @api
28392   */
28393  getTileCoordForCoordAndZ(t, i, s) {
28394    return this.getTileCoordForXYAndZ_(
28395      t[0],
28396      t[1],
28397      i,
28398      !1,
28399      s
28400    );
28401  }
28402  /**
28403   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28404   * @return {number} Tile resolution.
28405   */
28406  getTileCoordResolution(t) {
28407    return this.resolutions_[t[0]];
28408  }
28409  /**
28410   * Get the tile size for a zoom level. The type of the return value matches the
28411   * `tileSize` or `tileSizes` that the tile grid was configured with. To always
28412   * get an {@link import("../size.js").Size}, run the result through {@link module:ol/size.toSize}.
28413   * @param {number} z Z.
28414   * @return {number|import("../size.js").Size} Tile size.
28415   * @api
28416   */
28417  getTileSize(t) {
28418    return this.tileSize_ ? this.tileSize_ : this.tileSizes_[t];
28419  }
28420  /**
28421   * @param {number} z Zoom level.
28422   * @return {import("../TileRange.js").default} Extent tile range for the specified zoom level.
28423   */
28424  getFullTileRange(t) {
28425    return this.fullTileRanges_ ? this.fullTileRanges_[t] : this.extent_ ? this.getTileRangeForExtentAndZ(this.extent_, t) : null;
28426  }
28427  /**
28428   * @param {number} resolution Resolution.
28429   * @param {number|import("../array.js").NearestDirectionFunction} [opt_direction]
28430   *     If 0, the nearest resolution will be used.
28431   *     If 1, the nearest higher resolution (lower Z) will be used. If -1, the
28432   *     nearest lower resolution (higher Z) will be used. Default is 0.
28433   *     Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.
28434   *
28435   * For example to change tile Z at the midpoint of zoom levels
28436   * ```js
28437   * function(value, high, low) {
28438   *   return value - low * Math.sqrt(high / low);
28439   * }
28440   * ```
28441   * @return {number} Z.
28442   * @api
28443   */
28444  getZForResolution(t, i) {
28445    const s = ua(
28446      this.resolutions_,
28447      t,
28448      i || 0
28449    );
28450    return Ot(s, this.minZoom, this.maxZoom);
28451  }
28452  /**
28453   * The tile with the provided tile coordinate intersects the given viewport.
28454   * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.
28455   * @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.
28456   * @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
28457   */
28458  tileCoordIntersectsViewport(t, i) {
28459    return ag(
28460      i,
28461      0,
28462      i.length,
28463      2,
28464      this.getTileCoordExtent(t)
28465    );
28466  }
28467  /**
28468   * @param {!import("../extent.js").Extent} extent Extent for this tile grid.
28469   * @private
28470   */
28471  calculateTileRanges_(t) {
28472    const i = this.resolutions_.length, s = new Array(i);
28473    for (let n = this.minZoom; n < i; ++n)
28474      s[n] = this.getTileRangeForExtentAndZ(t, n);
28475    this.fullTileRanges_ = s;
28476  }
28477}
28478const Xw = Uw;
28479function Qg(e) {
28480  let t = e.getDefaultTileGrid();
28481  return t || (t = qw(e), e.setDefaultTileGrid(t)), t;
28482}
28483function $w(e, t, i) {
28484  const s = t[0], n = e.getTileCoordCenter(t), r = t_(i);
28485  if (!Rr(r, n)) {
28486    const o = mt(r), a = Math.ceil(
28487      (r[0] - n[0]) / o
28488    );
28489    return n[0] += o * a, e.getTileCoordForCoordAndZ(n, s);
28490  }
28491  return t;
28492}
28493function Yw(e, t, i, s) {
28494  s = s !== void 0 ? s : "top-left";
28495  const n = Kw(e, t, i);
28496  return new Xw({
28497    extent: e,
28498    origin: Qy(e, s),
28499    resolutions: n,
28500    tileSize: i
28501  });
28502}
28503function Kw(e, t, i, s) {
28504  t = t !== void 0 ? t : RE, i = ye(i !== void 0 ? i : Sh);
28505  const n = Yt(e), r = mt(e);
28506  s = s > 0 ? s : Math.max(r / i[0], n / i[1]);
28507  const o = t + 1, a = new Array(o);
28508  for (let l = 0; l < o; ++l)
28509    a[l] = s / Math.pow(2, l);
28510  return a;
28511}
28512function qw(e, t, i, s) {
28513  const n = t_(e);
28514  return Yw(n, t, i, s);
28515}
28516function t_(e) {
28517  e = Rt(e);
28518  let t = e.getExtent();
28519  if (!t) {
28520    const i = 180 * sr.degrees / e.getMetersPerUnit();
28521    t = ei(-i, -i, i, i);
28522  }
28523  return t;
28524}
28525class Vw extends ic {
28526  /**
28527   * @param {Options} options SourceTile source options.
28528   */
28529  constructor(t) {
28530    super({
28531      attributions: t.attributions,
28532      attributionsCollapsible: t.attributionsCollapsible,
28533      projection: t.projection,
28534      state: t.state,
28535      wrapX: t.wrapX,
28536      interpolate: t.interpolate
28537    }), this.on, this.once, this.un, this.opaque_ = t.opaque !== void 0 ? t.opaque : !1, this.tilePixelRatio_ = t.tilePixelRatio !== void 0 ? t.tilePixelRatio : 1, this.tileGrid = t.tileGrid !== void 0 ? t.tileGrid : null;
28538    const i = [256, 256];
28539    this.tileGrid && ye(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), i), this.tileCache = new jg(t.cacheSize || 0), this.tmpSize = [0, 0], this.key_ = t.key || "", this.tileOptions = {
28540      transition: t.transition,
28541      interpolate: t.interpolate
28542    }, this.zDirection = t.zDirection ? t.zDirection : 0;
28543  }
28544  /**
28545   * @return {boolean} Can expire cache.
28546   */
28547  canExpireCache() {
28548    return this.tileCache.canExpireCache();
28549  }
28550  /**
28551   * @param {import("../proj/Projection.js").default} projection Projection.
28552   * @param {!Object<string, boolean>} usedTiles Used tiles.
28553   */
28554  expireCache(t, i) {
28555    const s = this.getTileCacheForProjection(t);
28556    s && s.expireCache(i);
28557  }
28558  /**
28559   * @param {import("../proj/Projection.js").default} projection Projection.
28560   * @param {number} z Zoom level.
28561   * @param {import("../TileRange.js").default} tileRange Tile range.
28562   * @param {function(import("../Tile.js").default):(boolean|void)} callback Called with each
28563   *     loaded tile.  If the callback returns `false`, the tile will not be
28564   *     considered loaded.
28565   * @return {boolean} The tile range is fully covered with loaded tiles.
28566   */
28567  forEachLoadedTile(t, i, s, n) {
28568    const r = this.getTileCacheForProjection(t);
28569    if (!r)
28570      return !1;
28571    let o = !0, a, l, h;
28572    for (let c = s.minX; c <= s.maxX; ++c)
28573      for (let u = s.minY; u <= s.maxY; ++u)
28574        l = Ea(i, c, u), h = !1, r.containsKey(l) && (a = /** @type {
28574!import("../Tile.js").default} */
28575        r.get(l), h = a.getState() === H.LOADED, h && (h = n(a) !== !1)), h || (o = !1);
28576    return o;
28577  }
28578  /**
28579   * @param {import("../proj/Projection.js").default} projection Projection.
28580   * @return {number} Gutter.
28581   */
28582  getGutterForProjection(t) {
28583    return 0;
28584  }
28585  /**
28586   * Return the key to be used for all tiles in the source.
28587   * @return {string} The key for all tiles.
28588   */
28589  getKey() {
28590    return this.key_;
28591  }
28592  /**
28593   * Set the value to be used as the key for all tiles in the source.
28594   * @param {string} key The key for tiles.
28595   * @protected
28596   */
28597  setKey(t) {
28598    this.key_ !== t && (this.key_ = t, this.changed());
28599  }
28600  /**
28601   * @param {import("../proj/Projection.js").default} projection Projection.
28602   * @return {boolean} Opaque.
28603   */
28604  getOpaque(t) {
28605    return this.opaque_;
28606  }
28607  /**
28608   * @param {import("../proj/Projection").default} [projection] Projection.
28609   * @return {Array<number>|null} Resolutions.
28610   */
28611  getResolutions(t) {
28612    const i = t ? this.getTileGridForProjection(t) : this.tileGrid;
28613    return i ? i.getResolutions() : null;
28614  }
28615  /**
28616   * @abstract
28617   * @param {number} z Tile coordinate z.
28618   * @param {number} x Tile coordinate x.
28619   * @param {number} y Tile coordinate y.
28620   * @param {number} pixelRatio Pixel ratio.
28621   * @param {import("../proj/Projection.js").default} projection Projection.
28622   * @return {!import("../Tile.js").default} Tile.
28623   */
28624  getTile(t, i, s, n, r) {
28625    return Z();
28626  }
28627  /**
28628   * Return the tile grid of the tile source.
28629   * @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
28630   * @api
28631   */
28632  getTileGrid() {
28633    return this.tileGrid;
28634  }
28635  /**
28636   * @param {import("../proj/Projection.js").default} projection Projection.
28637   * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
28638   */
28639  getTileGridForProjection(t) {
28640    return this.tileGrid ? this.tileGrid : Qg(t);
28641  }
28642  /**
28643   * @param {import("../proj/Projection.js").default} projection Projection.
28644   * @return {import("../TileCache.js").default} Tile cache.
28645   * @protected
28646   */
28647  getTileCacheForProjection(t) {
28648    const i = this.getProjection();
28649    return at(
28650      i === null || di(i, t),
28651      68
28652      // A VectorTile source can only be rendered if it has a projection compatible with the view projection.
28653    ), this.tileCache;
28654  }
28655  /**
28656   * Get the tile pixel ratio for this source. Subclasses may override this
28657   * method, which is meant to return a supported pixel ratio that matches the
28658   * provided `pixelRatio` as close as possible.
28659   * @param {number} pixelRatio Pixel ratio.
28660   * @return {number} Tile pixel ratio.
28661   */
28662  getTilePixelRatio(t) {
28663    return this.tilePixelRatio_;
28664  }
28665  /**
28666   * @param {number} z Z.
28667   * @param {number} pixelRatio Pixel ratio.
28668   * @param {import("../proj/Projection.js").default} projection Projection.
28669   * @return {import("../size.js").Size} Tile size.
28670   */
28671  getTilePixelSize(t, i, s) {
28672    const n = this.getTileGridForProjection(s), r = this.getTilePixelRatio(i), o = ye(n.getTileSize(t), this.tmpSize);
28673    return r == 1 ? o : Eg(o, r, this.tmpSize);
28674  }
28675  /**
28676   * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
28677   * is outside the resolution and extent range of the tile grid, `null` will be
28678   * returned.
28679   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28680   * @param {import("../proj/Projection.js").default} [projection] Projection.
28681   * @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
28682   *     null if no tile URL should be created for the passed `tileCoord`.
28683   */
28684  getTileCoordForTileUrlFunction(t, i) {
28685    i = i !== void 0 ? i : this.getProjection();
28686    const s = this.getTileGridForProjection(i);
28687    return this.getWrapX() && i.isGlobal() && (t = $w(s, t, i)), Ub(t, s) ? t : null;
28688  }
28689  /**
28690   * Remove all cached tiles from the source. The next render cycle will fetch new tiles.
28691   * @api
28692   */
28693  clear() {
28694    this.tileCache.clear();
28695  }
28696  refresh() {
28697    this.clear(), super.refresh();
28698  }
28699  /**
28700   * Increases the cache size if needed
28701   * @param {number} tileCount Minimum number of tiles needed.
28702   * @param {import("../proj/Projection.js").default} projection Projection.
28703   */
28704  updateCacheSize(t, i) {
28705    const s = this.getTileCacheForProjection(i);
28706    t > s.highWaterMark && (s.highWaterMark = t);
28707  }
28708  /**
28709   * Marks a tile coord as being used, without triggering a load.
28710   * @abstract
28711   * @param {number} z Tile coordinate z.
28712   * @param {number} x Tile coordinate x.
28713   * @param {number} y Tile coordinate y.
28714   * @param {import("../proj/Projection.js").default} projection Projection.
28715   */
28716  useTile(t, i, s, n) {
28717  }
28718}
28719class Hw extends Ae {
28720  /**
28721   * @param {string} type Type.
28722   * @param {import("../Tile.js").default} tile The tile.
28723   */
28724  constructor(t, i) {
28725    super(t), this.tile = i;
28726  }
28727}
28728const Zw = Vw;
28729function Jw(e, t) {
28730  const i = /\{z\}/g, s = /\{x\}/g, n = /\{y\}/g, r = /\{-y\}/g;
28731  return (
28732    /**
28733     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
28734     * @param {number} pixelRatio Pixel ratio.
28735     * @param {import("./proj/Projection.js").default} projection Projection.
28736     * @return {string|undefined} Tile URL.
28737     */
28738    function(o, a, l) {
28739      if (o)
28740        return e.replace(i, o[0].toString()).replace(s, o[1].toString()).replace(n, o[2].toString()).replace(r, function() {
28741          const h = o[0], c = t.getFullTileRange(h);
28742          return at(c, 55), (c.getHeight() - o[2] - 1).toString();
28743        });
28744    }
28745  );
28746}
28747function Qw(e, t) {
28748  const i = e.length, s = new Array(i);
28749  for (let n = 0; n < i; ++n)
28750    s[n] = Jw(e[n], t);
28751  return tS(s);
28752}
28753function tS(e) {
28754  return e.length === 1 ? e[0] : (
28755    /**
28756     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
28757     * @param {number} pixelRatio Pixel ratio.
28758     * @param {import("./proj/Projection.js").default} projection Projection.
28759     * @return {string|undefined} Tile URL.
28760     */
28761    function(t, i, s) {
28762      if (!t)
28763        return;
28764      const n = zg(t), r = $i(n, e.length);
28765      return e[r](t, i, s);
28766    }
28767  );
28768}
28769function eS(e) {
28770  const t = [];
28771  let i = /\{([a-z])-([a-z])\}/.exec(e);
28772  if (i) {
28773    const s = i[1].charCodeAt(0), n = i[2].charCodeAt(0);
28774    let r;
28775    for (r = s; r <= n; ++r)
28776      t.push(e.replace(i[0], String.fromCharCode(r)));
28777    return t;
28778  }
28779  if (i = /\{(\d+)-(\d+)\}/.exec(e), i) {
28780    const s = parseInt(i[2], 10);
28781    for (let n = parseInt(i[1], 10); n <= s; n++)
28782      t.push(e.replace(i[0], n.toString()));
28783    return t;
28784  }
28785  return t.push(e), t;
28786}
28787class lc extends Zw {
28788  /**
28789   * @param {Options} options Image tile options.
28790   */
28791  constructor(t) {
28792    super({
28793      attributions: t.attributions,
28794      cacheSize: t.cacheSize,
28795      opaque: t.opaque,
28796      projection: t.projection,
28797      state: t.state,
28798      tileGrid: t.tileGrid,
28799      tilePixelRatio: t.tilePixelRatio,
28800      wrapX: t.wrapX,
28801      transition: t.transition,
28802      interpolate: t.interpolate,
28803      key: t.key,
28804      attributionsCollapsible: t.attributionsCollapsible,
28805      zDirection: t.zDirection
28806    }), this.generateTileUrlFunction_ = this.tileUrlFunction === lc.prototype.tileUrlFunction, this.tileLoadFunction = t.tileLoadFunction, t.tileUrlFunction && (this.tileUrlFunction = t.tileUrlFunction), this.urls = null, t.urls ? this.setUrls(t.urls) : t.url && this.setUrl(t.url), this.tileLoadingKeys_ = {};
28807  }
28808  /**
28809   * Return the tile load function of the source.
28810   * @return {import("../Tile.js").LoadFunction} TileLoadFunction
28811   * @api
28812   */
28813  getTileLoadFunction() {
28814    return this.tileLoadFunction;
28815  }
28816  /**
28817   * Return the tile URL function of the source.
28818   * @return {import("../Tile.js").UrlFunction} TileUrlFunction
28819   * @api
28820   */
28821  getTileUrlFunction() {
28822    return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction ? this.tileUrlFunction.bind(this) : this.tileUrlFunction;
28823  }
28824  /**
28825   * Return the URLs used for this source.
28826   * When a tileUrlFunction is used instead of url or urls,
28827   * null will be returned.
28828   * @return {!Array<string>|null} URLs.
28829   * @api
28830   */
28831  getUrls() {
28832    return this.urls;
28833  }
28834  /**
28835   * Handle tile change events.
28836   * @param {import("../events/Event.js").default} event Event.
28837   * @protected
28838   */
28839  handleTileChange(t) {
28840    const i = (
28841      /** @type {import("../Tile.js").default} */
28842      t.target
28843    ), s = ot(i), n = i.getState();
28844    let r;
28845    n == H.LOADING ? (this.tileLoadingKeys_[s] = !0, r = il.TILELOADSTART) : s in this.tileLoadingKeys_ && (delete this.tileLoadingKeys_[s], r = n == H.ERROR ? il.TILELOADERROR : n == H.LOADED ? il.TILELOADEND : void 0), r != null && this.dispatchEvent(new Hw(r, i));
28846  }
28847  /**
28848   * Set the tile load function of the source.
28849   * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
28850   * @api
28851   */
28852  setTileLoadFunction(t) {
28853    this.tileCache.clear(), this.tileLoadFunction = t, this.changed();
28854  }
28855  /**
28856   * Set the tile URL function of the source.
28857   * @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
28858   * @param {string} [key] Optional new tile key for the source.
28859   * @api
28860   */
28861  setTileUrlFunction(t, i) {
28862    this.tileUrlFunction = t, this.tileCache.pruneExceptNewestZ(), typeof i < "u" ? this.setKey(i) : this.changed();
28863  }
28864  /**
28865   * Set the URL to use for requests.
28866   * @param {string} url URL.
28867   * @api
28868   */
28869  setUrl(t) {
28870    const i = eS(t);
28871    this.urls = i, this.setUrls(i);
28872  }
28873  /**
28874   * Set the URLs to use for requests.
28875   * @param {Array<string>} urls URLs.
28876   * @api
28877   */
28878  setUrls(t) {
28879    this.urls = t;
28880    const i = t.join(`
28881`);
28882    this.generateTileUrlFunction_ ? this.setTileUrlFunction(Qw(t, this.tileGrid), i) : this.setKey(i);
28883  }
28884  /**
28885   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
28886   * @param {number} pixelRatio Pixel ratio.
28887   * @param {import("../proj/Projection.js").default} projection Projection.
28888   * @return {string|undefined} Tile URL.
28889   */
28890  tileUrlFunction(t, i, s) {
28891  }
28892  /**
28893   * Marks a tile coord as being used, without triggering a load.
28894   * @param {number} z Tile coordinate z.
28895   * @param {number} x Tile coordinate x.
28896   * @param {number} y Tile coordinate y.
28897   */
28898  useTile(t, i, s) {
28899    const n = Ea(t, i, s);
28900    this.tileCache.containsKey(n) && this.tileCache.get(n);
28901  }
28902}
28903const iS = lc;
28904class sS extends iS {
28905  /**
28906   * @param {!Options} options Image tile options.
28907   */
28908  constructor(t) {
28909    super({
28910      attributions: t.attributions,
28911      cacheSize: t.cacheSize,
28912      opaque: t.opaque,
28913      projection: t.projection,
28914      state: t.state,
28915      tileGrid: t.tileGrid,
28916      tileLoadFunction: t.tileLoadFunction ? t.tileLoadFunction : nS,
28917      tilePixelRatio: t.tilePixelRatio,
28918      tileUrlFunction: t.tileUrlFunction,
28919      url: t.url,
28920      urls: t.urls,
28921      wrapX: t.wrapX,
28922      transition: t.transition,
28923      interpolate: t.interpolate !== void 0 ? t.interpolate : !0,
28924      key: t.key,
28925      attributionsCollapsible: t.attributionsCollapsible,
28926      zDirection: t.zDirection
28927    }), this.crossOrigin = t.crossOrigin !== void 0 ? t.crossOrigin : null, this.tileClass = t.tileClass !== void 0 ? t.tileClass : Ng, this.tileCacheForProjection = {}, this.tileGridForProjection = {}, this.reprojectionErrorThreshold_ = t.reprojectionErrorThreshold, this.renderReprojectionEdges_ = !1;
28928  }
28929  /**
28930   * @return {boolean} Can expire cache.
28931   */
28932  canExpireCache() {
28933    if (this.tileCache.canExpireCache())
28934      return !0;
28935    for (const t in this.tileCacheForProjection)
28936      if (this.tileCacheForProjection[t].canExpireCache())
28937        return !0;
28938    return !1;
28939  }
28940  /**
28941   * @param {import("../proj/Projection.js").default} projection Projection.
28942   * @param {!Object<string, boolean>} usedTiles Used tiles.
28943   */
28944  expireCache(t, i) {
28945    const s = this.getTileCacheForProjection(t);
28946    this.tileCache.expireCache(
28947      this.tileCache == s ? i : {}
28948    );
28949    for (const n in this.tileCacheForProjection) {
28950      const r = this.tileCacheForProjection[n];
28951      r.expireCache(r == s ? i : {});
28952    }
28953  }
28954  /**
28955   * @param {import("../proj/Projection.js").default} projection Projection.
28956   * @return {number} Gutter.
28957   */
28958  getGutterForProjection(t) {
28959    return this.getProjection() && t && !di(this.getProjection(), t) ? 0 : this.getGutter();
28960  }
28961  /**
28962   * @return {number} Gutter.
28963   */
28964  getGutter() {
28965    return 0;
28966  }
28967  /**
28968   * Return the key to be used for all tiles in the source.
28969   * @return {string} The key for all tiles.
28970   */
28971  getKey() {
28972    let t = super.getKey();
28973    return this.getInterpolate() || (t += ":disable-interpolation"), t;
28974  }
28975  /**
28976   * @param {import("../proj/Projection.js").default} projection Projection.
28977   * @return {boolean} Opaque.
28978   */
28979  getOpaque(t) {
28980    return this.getProjection() && t && !di(this.getProjection(), t) ? !1 : super.getOpaque(t);
28981  }
28982  /**
28983   * @param {import("../proj/Projection.js").default} projection Projection.
28984   * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
28985   */
28986  getTileGridForProjection(t) {
28987    const i = this.getProjection();
28988    if (this.tileGrid && (!i || di(i, t)))
28989      return this.tileGrid;
28990    const s = ot(t);
28991    return s in this.tileGridForProjection || (this.tileGridForProjection[s] = Qg(t)), this.tileGridForProjection[s];
28992  }
28993  /**
28994   * @param {import("../proj/Projection.js").default} projection Projection.
28995   * @return {import("../TileCache.js").default} Tile cache.
28996   */
28997  getTileCacheForProjection(t) {
28998    const i = this.getProjection();
28999    if (!i || di(i, t))
29000      return this.tileCache;
29001    const s = ot(t);
29002    return s in this.tileCacheForProjection || (this.tileCacheForProjection[s] = new jg(
29003      this.tileCache.highWaterMark
29004    )), this.tileCacheForProjection[s];
29005  }
29006  /**
29007   * @param {number} z Tile coordinate z.
29008   * @param {number} x Tile coordinate x.
29009   * @param {number} y Tile coordinate y.
29010   * @param {number} pixelRatio Pixel ratio.
29011   * @param {import("../proj/Projection.js").default} projection Projection.
29012   * @param {string} key The key set on the tile.
29013   * @return {!ImageTile} Tile.
29014   * @private
29015   */
29016  createTile_(t, i, s, n, r, o) {
29017    const a = [t, i, s], l = this.getTileCoordForTileUrlFunction(
29018      a,
29019      r
29020    ), h = l ? this.tileUrlFunction(l, n, r) : void 0, c = new this.tileClass(
29021      a,
29022      h !== void 0 ? H.IDLE : H.EMPTY,
29023      h !== void 0 ? h : "",
29024      this.crossOrigin,
29025      this.tileLoadFunction,
29026      this.tileOptions
29027    );
29028    return c.key = o, c.addEventListener(et.CHANGE, this.handleTileChange.bind(this)), c;
29029  }
29030  /**
29031   * @param {number} z Tile coordinate z.
29032   * @param {number} x Tile coordinate x.
29033   * @param {number} y Tile coordinate y.
29034   * @param {number} pixelRatio Pixel ratio.
29035   * @param {import("../proj/Projection.js").default} projection Projection.
29036   * @return {!(ImageTile|ReprojTile)} Tile.
29037   */
29038  getTile(t, i, s, n, r) {
29039    const o = this.getProjection();
29040    if (!o || !r || di(o, r))
29041      return this.getTileInternal(
29042        t,
29043        i,
29044        s,
29045        n,
29046        o || r
29047      );
29048    const a = this.getTileCacheForProjection(r), l = [t, i, s];
29049    let h;
29050    const c = Gg(l);
29051    a.containsKey(c) && (h = a.get(c));
29052    const u = this.getKey();
29053    if (h && h.key == u)
29054      return h;
29055    const d = this.getTileGridForProjection(o), f = this.getTileGridForProjection(r), g = this.getTileCoordForTileUrlFunction(
29056      l,
29057      r
29058    ), _ = new zl(
29059      o,
29060      d,
29061      r,
29062      f,
29063      l,
29064      g,
29065      this.getTilePixelRatio(n),
29066      this.getGutter(),
29067      (m, p, y, v) => this.getTileInternal(m, p, y, v, o),
29068      this.reprojectionErrorThreshold_,
29069      this.renderReprojectionEdges_,
29070      this.getInterpolate()
29071    );
29072    return _.key = u, h ? (_.interimTile = h, _.refreshInterimChain(), a.replace(c, _)) : a.set(c, _), _;
29073  }
29074  /**
29075   * @param {number} z Tile coordinate z.
29076   * @param {number} x Tile coordinate x.
29077   * @param {number} y Tile coordinate y.
29078   * @param {number} pixelRatio Pixel ratio.
29079   * @param {!import("../proj/Projection.js").default} projection Projection.
29080   * @return {!ImageTile} Tile.
29081   * @protected
29082   */
29083  getTileInternal(t, i, s, n, r) {
29084    let o = null;
29085    const a = Ea(t, i, s), l = this.getKey();
29086    if (!this.tileCache.containsKey(a))
29087      o = this.createTile_(t, i, s, n, r, l), this.tileCache.set(a, o);
29088    else if (o = this.tileCache.get(a), o.key != l) {
29089      const h = o;
29090      o = this.createTile_(t, i, s, n, r, l), h.getState() == H.IDLE ? o.interimTile = h.interimTile : o.interimTile = h, o.refreshInterimChain(), this.tileCache.replace(a, o);
29091    }
29092    return o;
29093  }
29094  /**
29095   * Sets whether to render reprojection edges or not (usually for debugging).
29096   * @param {boolean} render Render the edges.
29097   * @api
29098   */
29099  setRenderReprojectionEdges(t) {
29100    if (this.renderReprojectionEdges_ != t) {
29101      this.renderReprojectionEdges_ = t;
29102      for (const i in this.tileCacheForProjection)
29103        this.tileCacheForProjection[i].clear();
29104      this.changed();
29105    }
29106  }
29107  /**
29108   * Sets the tile grid to use when reprojecting the tiles to the given
29109   * projection instead of the default tile grid for the projection.
29110   *
29111   * This can be useful when the default tile grid cannot be created
29112   * (e.g. projection has no extent defined) or
29113   * for optimization reasons (custom tile size, resolutions, ...).
29114   *
29115   * @param {import("../proj.js").ProjectionLike} projection Projection.
29116   * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
29117   * @api
29118   */
29119  setTileGridForProjection(t, i) {
29120    const s = Rt(t);
29121    if (s) {
29122      const n = ot(s);
29123      n in this.tileGridForProjection || (this.tileGridForProjection[n] = i);
29124    }
29125  }
29126  clear() {
29127    super.clear();
29128    for (const t in this.tileCacheForProjection)
29129      this.tileCacheForProjection[t].clear();
29130  }
29131}
29132function nS(e, t) {
29133  e.getImage().src = t;
29134}
29135const rS = sS;
29136class oS extends rS {
29137  /**
29138   * @param {Options} [options] Tile WMS options.
29139   */
29140  constructor(t) {
29141    t = t || /** @type {Options} */
29142    {};
29143    const i = Object.assign({}, t.params), s = "TRANSPARENT" in i ? i.TRANSPARENT : !0;
29144    super({
29145      attributions: t.attributions,
29146      attributionsCollapsible: t.attributionsCollapsible,
29147      cacheSize: t.cacheSize,
29148      crossOrigin: t.crossOrigin,
29149      interpolate: t.interpolate,
29150      opaque: !s,
29151      projection: t.projection,
29152      reprojectionErrorThreshold: t.reprojectionErrorThreshold,
29153      tileClass: t.tileClass,
29154      tileGrid: t.tileGrid,
29155      tileLoadFunction: t.tileLoadFunction,
29156      url: t.url,
29157      urls: t.urls,
29158      wrapX: t.wrapX !== void 0 ? t.wrapX : !0,
29159      transition: t.transition,
29160      zDirection: t.zDirection
29161    }), this.gutter_ = t.gutter !== void 0 ? t.gutter : 0, this.params_ = i, this.v13_ = !0, this.serverType_ = t.serverType, this.hidpi_ = t.hidpi !== void 0 ? t.hidpi : !0, this.tmpExtent_ = ve(), this.updateV13_(), this.setKey(this.getKeyForParams_());
29162  }
29163  /**
29164   * Return the GetFeatureInfo URL for the passed coordinate, resolution, and
29165   * projection. Return `undefined` if the GetFeatureInfo URL cannot be
29166   * constructed.
29167   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
29168   * @param {number} resolution Resolution.
29169   * @param {import("../proj.js").ProjectionLike} projection Projection.
29170   * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
29171   *     be provided. If `QUERY_LAYERS` is not provided then the layers specified
29172   *     in the `LAYERS` parameter will be used. `VERSION` should not be
29173   *     specified here.
29174   * @return {string|undefined} GetFeatureInfo URL.
29175   * @api
29176   */
29177  getFeatureInfoUrl(t, i, s, n) {
29178    const r = Rt(s), o = this.getProjection();
29179    let a = this.getTileGrid();
29180    a || (a = this.getTileGridForProjection(r));
29181    const l = a.getZForResolution(i, this.zDirection), h = a.getTileCoordForCoordAndZ(t, l);
29182    if (a.getResolutions().length <= h[0])
29183      return;
29184    let c = a.getResolution(h[0]), u = a.getTileCoordExtent(h, this.tmpExtent_), d = ye(a.getTileSize(h[0]), this.tmpSize);
29185    const f = this.gutter_;
29186    f !== 0 && (d = Fu(d, f, this.tmpSize), u = Ms(u, c * f, u)), o && o !== r && (c = vr(
29187      o,
29188      r,
29189      t,
29190      c
29191    ), u = m1(
29192      u,
29193      r,
29194      o
29195    ), t = Jo(t, r, o));
29196    const g = {
29197      SERVICE: "WMS",
29198      VERSION: Ui,
29199      REQUEST: "GetFeatureInfo",
29200      FORMAT: "image/png",
29201      TRANSPARENT: !0,
29202      QUERY_LAYERS: this.params_.LAYERS
29203    };
29204    Object.assign(g, this.params_, n);
29205    const _ = Math.floor((t[0] - u[0]) / c), m = Math.floor((u[3] - t[1]) / c);
29206    return g[this.v13_ ? "I" : "X"] = _, g[this.v13_ ? "J" : "Y"] = m, this.getRequestUrl_(
29207      h,
29208      d,
29209      u,
29210      1,
29211      o || r,
29212      g
29213    );
29214  }
29215  /**
29216   * Return the GetLegendGraphic URL, optionally optimized for the passed
29217   * resolution and possibly including any passed specific parameters. Returns
29218   * `undefined` if the GetLegendGraphic URL cannot be constructed.
29219   *
29220   * @param {number} [resolution] Resolution. If set to undefined, `SCALE`
29221   *     will not be calculated and included in URL.
29222   * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the
29223   *     request is generated for this wms layer, else it will try to use the
29224   *     configured wms layer. Default `FORMAT` is `image/png`.
29225   *     `VERSION` should not be specified here.
29226   * @return {string|undefined} GetLegendGraphic URL.
29227   * @api
29228   */
29229  getLegendUrl(t, i) {
29230    if (this.urls[0] === void 0)
29231      return;
29232    const s = {
29233      SERVICE: "WMS",
29234      VERSION: Ui,
29235      REQUEST: "GetLegendGraphic",
29236      FORMAT: "image/png"
29237    };
29238    if (i === void 0 || i.LAYER === void 0) {
29239      const n = this.params_.LAYERS;
29240      if (!(!Array.isArray(n) || n.length === 1))
29241        return;
29242      s.LAYER = n;
29243    }
29244    if (t !== void 0) {
29245      const n = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1, r = 28e-5;
29246      s.SCALE = t * n / r;
29247    }
29248    return Object.assign(s, i), Yo(
29249      /** @type {string} */
29250      this.urls[0],
29251      s
29252    );
29253  }
29254  /**
29255   * @return {number} Gutter.
29256   */
29257  getGutter() {
29258    return this.gutter_;
29259  }
29260  /**
29261   * Get the user-provided params, i.e. those passed to the constructor through
29262   * the "params" option, and possibly updated using the updateParams method.
29263   * @return {Object} Params.
29264   * @api
29265   */
29266  getParams() {
29267    return this.params_;
29268  }
29269  /**
29270   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
29271   * @param {import("../size.js").Size} tileSize Tile size.
29272   * @param {import("../extent.js").Extent} tileExtent Tile extent.
29273   * @param {number} pixelRatio Pixel ratio.
29274   * @param {import("../proj/Projection.js").default} projection Projection.
29275   * @param {Object} params Params.
29276   * @return {string|undefined} Request URL.
29277   * @private
29278   */
29279  getRequestUrl_(t, i, s, n, r, o) {
29280    const a = this.urls;
29281    if (!a)
29282      return;
29283    if (o.WIDTH = i[0], o.HEIGHT = i[1], o[this.v13_ ? "CRS" : "SRS"] = r.getCode(), "STYLES" in this.params_ || (o.STYLES = ""), n != 1)
29284      switch (this.serverType_) {
29285        case "geoserver":
29286          const u = 90 * n + 0.5 | 0;
29287          "FORMAT_OPTIONS" in o ? o.FORMAT_OPTIONS += ";dpi:" + u : o.FORMAT_OPTIONS = "dpi:" + u;
29288          break;
29289        case "mapserver":
29290          o.MAP_RESOLUTION = 90 * n;
29291          break;
29292        case "carmentaserver":
29293        case "qgis":
29294          o.DPI = 90 * n;
29295          break;
29296        default:
29297          at(!1, 52);
29298          break;
29299      }
29300    const l = r.getAxisOrientation(), h = s;
29301    if (this.v13_ && l.substr(0, 2) == "ne") {
29302      let u;
29303      u = s[0], h[0] = s[1], h[1] = u, u = s[2], h[2] = s[3], h[3] = u;
29304    }
29305    o.BBOX = h.join(",");
29306    let c;
29307    if (a.length == 1)
29308      c = a[0];
29309    else {
29310      const u = $i(zg(t), a.length);
29311      c = a[u];
29312    }
29313    return Yo(c, o);
29314  }
29315  /**
29316   * Get the tile pixel ratio for this source.
29317   * @param {number} pixelRatio Pixel ratio.
29318   * @return {number} Tile pixel ratio.
29319   */
29320  getTilePixelRatio(t) {
29321    return !this.hidpi_ || this.serverType_ === void 0 ? 1 : t;
29322  }
29323  /**
29324   * @private
29325   * @return {string} The key for the current params.
29326   */
29327  getKeyForParams_() {
29328    let t = 0;
29329    const i = [];
29330    for (const s in this.params_)
29331      i[t++] = s + "-" + this.params_[s];
29332    return i.join("/");
29333  }
29334  /**
29335   * Update the user-provided params.
29336   * @param {Object} params Params.
29337   * @api
29338   */
29339  updateParams(t) {
29340    Object.assign(this.params_, t), this.updateV13_(), this.setKey(this.getKeyForParams_());
29341  }
29342  /**
29343   * @private
29344   */
29345  updateV13_() {
29346    const t = this.params_.VERSION || Ui;
29347    this.v13_ = Ud(t, "1.3") >= 0;
29348  }
29349  /**
29350   * @param {import("../tilecoord.js").TileCoord} tileCoord The tile coordinate
29351   * @param {number} pixelRatio The pixel ratio
29352   * @param {import("../proj/Projection.js").default} projection The projection
29353   * @return {string|undefined} The tile URL
29354   * @override
29355   */
29356  tileUrlFunction(t, i, s) {
29357    let n = this.getTileGrid();
29358    if (n || (n = this.getTileGridForProjection(s)), n.getResolutions().length <= t[0])
29359      return;
29360    i != 1 && (!this.hidpi_ || this.serverType_ === void 0) && (i = 1);
29361    const r = n.getResolution(t[0]);
29362    let o = n.getTileCoordExtent(t, this.tmpExtent_), a = ye(n.getTileSize(t[0]), this.tmpSize);
29363    const l = this.gutter_;
29364    l !== 0 && (a = Fu(a, l, this.tmpSize), o = Ms(o, r * l, o)), i != 1 && (a = Eg(a, i, this.tmpSize));
29365    const h = {
29366      SERVICE: "WMS",
29367      VERSION: Ui,
29368      REQUEST: "GetMap",
29369      FORMAT: "image/png",
29370      TRANSPARENT: !0
29371    };
29372    return Object.assign(h, this.params_), this.getRequestUrl_(
29373      t,
29374      a,
29375      o,
29376      i,
29377      s,
29378      h
29379    );
29380  }
29381}
29382const aS = oS;
29383class lS extends Lr {
29384  /**
29385   * @param {Options<ImageSourceType>} [options] Layer options.
29386   */
29387  constructor(t) {
29388    t = t || {}, super(t);
29389  }
29390}
29391const hS = lS;
29392class cS extends ec {
29393  /**
29394   * @param {import("../../layer/Image.js").default} imageLayer Image layer.
29395   */
29396  constructor(t) {
29397    super(t), this.image_ = null;
29398  }
29399  /**
29400   * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
29401   */
29402  getImage() {
29403    return this.image_ ? this.image_.getImage() : null;
29404  }
29405  /**
29406   * Determine whether render should be called.
29407   * @param {import("../../Map.js").FrameState} frameState Frame state.
29408   * @return {boolean} Layer is ready to be rendered.
29409   */
29410  prepareFrame(t) {
29411    const i = t.layerStatesArray[t.layerIndex], s = t.pixelRatio, n = t.viewState, r = n.resolution, o = this.getLayer().getSource(), a = t.viewHints;
29412    let l = t.extent;
29413    if (i.extent !== void 0 && (l = gs(
29414      l,
29415      He(i.extent, n.projection)
29416    )), !a[Xt.ANIMATING] && !a[Xt.INTERACTING] && !Is(l))
29417      if (o) {
29418        const h = n.projection, c = o.getImage(
29419          l,
29420          r,
29421          s,
29422          h
29423        );
29424        c && (this.loadImage(c) ? this.image_ = c : c.getState() === rt.EMPTY && (this.image_ = null));
29425      } else
29426        this.image_ = null;
29427    return !!this.image_;
29428  }
29429  /**
29430   * @param {import("../../pixel.js").Pixel} pixel Pixel.
29431   * @return {Uint8ClampedArray} Data at the pixel location.
29432   */
29433  getData(t) {
29434    const i = this.frameState;
29435    if (!i)
29436      return null;
29437    const s = this.getLayer(), n = zt(
29438      i.pixelToCoordinateTransform,
29439      t.slice()
29440    ), r = s.getExtent();
29441    if (r && !Rr(r, n))
29442      return null;
29443    const o = this.image_.getExtent(), a = this.getImage(), l = mt(o), h = Math.floor(
29444      a.width * ((n[0] - o[0]) / l)
29445    );
29446    if (h < 0 || h >= a.width)
29447      return null;
29448    const c = Yt(o), u = Math.floor(
29449      a.height * ((o[3] - n[1]) / c)
29450    );
29451    return u < 0 || u >= a.height ? null : this.getImageData(a, h, u);
29452  }
29453  /**
29454   * Render the layer.
29455   * @param {import("../../Map.js").FrameState} frameState Frame state.
29456   * @param {HTMLElement} target Target that may be used to render content to.
29457   * @return {HTMLElement} The rendered element.
29458   */
29459  renderFrame(t, i) {
29460    const s = this.image_, n = s.getExtent(), r = s.getResolution(), o = s.getPixelRatio(), a = t.layerStatesArray[t.layerIndex], l = t.pixelRatio, h = t.viewState, c = h.center, u = h.resolution, d = l * r / (u * o), f = t.extent, g = h.resolution, _ = h.rotation, m = Math.round(mt(f) / g * l), p = Math.round(Yt(f) / g * l);
29461    si(
29462      this.pixelTransform,
29463      t.size[0] / 2,
29464      t.size[1] / 2,
29465      1 / l,
29466      1 / l,
29467      _,
29468      -m / 2,
29469      -p / 2
29470    ), fa(this.inversePixelTransform, this.pixelTransform);
29471    const y = wh(this.pixelTransform);
29472    this.useContainer(i, y, this.getBackground(t));
29473    const v = this.context, E = v.canvas;
29474    E.width != m || E.height != p ? (E.width = m, E.height = p) : this.containerReused || v.clearRect(0, 0, m, p);
29475    let C = !1, w = !0;
29476    if (a.extent) {
29477      const V = He(
29478        a.extent,
29479        h.projection
29480      );
29481      w = ee(V, t.extent), C = w && !Gi(V, t.extent), C && this.clipUnrotated(v, t, V);
29482    }
29483    const O = this.getImage(), R = si(
29484      this.tempTransform,
29485      m / 2,
29486      p / 2,
29487      d,
29488      d,
29489      0,
29490      o * (n[0] - c[0]) / r,
29491      o * (c[1] - n[3]) / r
29492    );
29493    this.renderedResolution = r * l / o;
29494    const j = O.width * R[0], $ = O.height * R[3];
29495    if (this.getLayer().getSource().getInterpolate() || (v.imageSmoothingEnabled = !1), this.preRender(v, t), w && j >= 0.5 && $ >= 0.5) {
29496      const V = R[4], tt = R[5], J = a.opacity;
29497      let St;
29498      J !== 1 && (St = v.globalAlpha, v.globalAlpha = J), v.drawImage(O, 0, 0, +O.width, +O.height, V, tt, j, $), J !== 1 && (v.globalAlpha = St);
29499    }
29500    return this.postRender(v, t), C && v.restore(), v.imageSmoothingEnabled = !0, y !== E.style.transform && (E.style.transform = y), this.container;
29501  }
29502}
29503const uS = cS;
29504class dS extends hS {
29505  /**
29506   * @param {import("./BaseImage.js").Options<ImageSourceType>} [options] Layer options.
29507   */
29508  constructor(t) {
29509    super(t);
29510  }
29511  createRenderer() {
29512    return new uS(this);
29513  }
29514  /**
29515   * Get data for a pixel location.  A four element RGBA array will be returned.  For requests outside the
29516   * layer extent, `null` will be returned.  Data for an image can only be retrieved if the
29517   * source's `crossOrigin` property is set.
29518   *
29519   * ```js
29520   * // display layer data on every pointer move
29521   * map.on('pointermove', (event) => {
29522   *   console.log(layer.getData(event.pixel));
29523   * });
29524   * ```
29525   * @param {import("../pixel").Pixel} pixel Pixel.
29526   * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
29527   * @api
29528   */
29529  getData(t) {
29530    return super.getData(t);
29531  }
29532}
29533const fS = dS, lo = {
29534  PRELOAD: "preload",
29535  USE_INTERIM_TILES_ON_ERROR: "useInterimTilesOnError"
29536};
29537class gS extends Lr {
29538  /**
29539   * @param {Options<TileSourceType>} [options] Tile layer options.
29540   */
29541  constructor(t) {
29542    t = t || {};
29543    const i = Object.assign({}, t);
29544    delete i.preload, delete i.useInterimTilesOnError, super(i), this.on, this.once, this.un, this.setPreload(t.preload !== void 0 ? t.preload : 0), this.setUseInterimTilesOnError(
29545      t.useInterimTilesOnError !== void 0 ? t.useInterimTilesOnError : !0
29546    );
29547  }
29548  /**
29549   * Return the level as number to which we will preload tiles up to.
29550   * @return {number} The level to preload tiles up to.
29551   * @observable
29552   * @api
29553   */
29554  getPreload() {
29555    return (
29556      /** @type {number} */
29557      this.get(lo.PRELOAD)
29558    );
29559  }
29560  /**
29561   * Set the level as number to which we will preload tiles up to.
29562   * @param {number} preload The level to preload tiles up to.
29563   * @observable
29564   * @api
29565   */
29566  setPreload(t) {
29567    this.set(lo.PRELOAD, t);
29568  }
29569  /**
29570   * Whether we use interim tiles on error.
29571   * @return {boolean} Use interim tiles on error.
29572   * @observable
29573   * @api
29574   */
29575  getUseInterimTilesOnError() {
29576    return (
29577      /** @type {boolean} */
29578      this.get(lo.USE_INTERIM_TILES_ON_ERROR)
29579    );
29580  }
29581  /**
29582   * Set whether we use interim tiles on error.
29583   * @param {boolean} useInterimTilesOnError Use interim tiles on error.
29584   * @observable
29585   * @api
29586   */
29587  setUseInterimTilesOnError(t) {
29588    this.set(lo.USE_INTERIM_TILES_ON_ERROR, t);
29589  }
29590  /**
29591   * Get data for a pixel location.  The return type depends on the source data.  For image tiles,
29592   * a four element RGBA array will be returned.  For data tiles, the array length 
29592will match the
29593   * number of bands in the dataset.  For requests outside the layer extent, `null` will be returned.
29594   * Data for a image tiles can only be retrieved if the source's `crossOrigin` property is set.
29595   *
29596   * ```js
29597   * // display layer data on every pointer move
29598   * map.on('pointermove', (event) => {
29599   *   console.log(layer.getData(event.pixel));
29600   * });
29601   * ```
29602   * @param {import("../pixel").Pixel} pixel Pixel.
29603   * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
29604   * @api
29605   */
29606  getData(t) {
29607    return super.getData(t);
29608  }
29609}
29610const _S = gS;
29611class mS extends ec {
29612  /**
29613   * @param {LayerType} tileLayer Tile layer.
29614   */
29615  constructor(t) {
29616    super(t), this.extentChanged = !0, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedRevision, this.renderedTiles = [], this.newTiles_ = !1, this.tmpExtent = ve(), this.tmpTileRange_ = new Bg(0, 0, 0, 0);
29617  }
29618  /**
29619   * @protected
29620   * @param {import("../../Tile.js").default} tile Tile.
29621   * @return {boolean} Tile is drawable.
29622   */
29623  isDrawableTile(t) {
29624    const i = this.getLayer(), s = t.getState(), n = i.getUseInterimTilesOnError();
29625    return s == H.LOADED || s == H.EMPTY || s == H.ERROR && !n;
29626  }
29627  /**
29628   * @param {number} z Tile coordinate z.
29629   * @param {number} x Tile coordinate x.
29630   * @param {number} y Tile coordinate y.
29631   * @param {import("../../Map.js").FrameState} frameState Frame state.
29632   * @return {!import("../../Tile.js").default} Tile.
29633   */
29634  getTile(t, i, s, n) {
29635    const r = n.pixelRatio, o = n.viewState.projection, a = this.getLayer();
29636    let h = a.getSource().getTile(t, i, s, r, o);
29637    return h.getState() == H.ERROR && a.getUseInterimTilesOnError() && a.getPreload() > 0 && (this.newTiles_ = !0), this.isDrawableTile(h) || (h = h.getInterimTile()), h;
29638  }
29639  /**
29640   * @param {import("../../pixel.js").Pixel} pixel Pixel.
29641   * @return {Uint8ClampedArray} Data at the pixel location.
29642   */
29643  getData(t) {
29644    const i = this.frameState;
29645    if (!i)
29646      return null;
29647    const s = this.getLayer(), n = zt(
29648      i.pixelToCoordinateTransform,
29649      t.slice()
29650    ), r = s.getExtent();
29651    if (r && !Rr(r, n))
29652      return null;
29653    const o = i.pixelRatio, a = i.viewState.projection, l = i.viewState, h = s.getRenderSource(), c = h.getTileGridForProjection(l.projection), u = h.getTilePixelRatio(i.pixelRatio);
29654    for (let d = c.getZForResolution(l.resolution); d >= c.getMinZoom(); --d) {
29655      const f = c.getTileCoordForCoordAndZ(n, d), g = h.getTile(
29656        d,
29657        f[1],
29658        f[2],
29659        o,
29660        a
29661      );
29662      if (!(g instanceof Ng || g instanceof zl) || g instanceof zl && g.getState() === H.EMPTY)
29663        return null;
29664      if (g.getState() !== H.LOADED)
29665        continue;
29666      const _ = c.getOrigin(d), m = ye(c.getTileSize(d)), p = c.getResolution(d), y = Math.floor(
29667        u * ((n[0] - _[0]) / p - f[1] * m[0])
29668      ), v = Math.floor(
29669        u * ((_[1] - n[1]) / p - f[2] * m[1])
29670      ), E = Math.round(
29671        u * h.getGutterForProjection(l.projection)
29672      );
29673      return this.getImageData(g.getImage(), y + E, v + E);
29674    }
29675    return null;
29676  }
29677  /**
29678   * @param {Object<number, Object<string, import("../../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
29679   * @param {number} zoom Zoom level.
29680   * @param {import("../../Tile.js").default} tile Tile.
29681   * @return {boolean|void} If `false`, the tile will not be considered loaded.
29682   */
29683  loadedTileCallback(t, i, s) {
29684    return this.isDrawableTile(s) ? super.loadedTileCallback(t, i, s) : !1;
29685  }
29686  /**
29687   * Determine whether render should be called.
29688   * @param {import("../../Map.js").FrameState} frameState Frame state.
29689   * @return {boolean} Layer is ready to be rendered.
29690   */
29691  prepareFrame(t) {
29692    return !!this.getLayer().getSource();
29693  }
29694  /**
29695   * Render the layer.
29696   * @param {import("../../Map.js").FrameState} frameState Frame state.
29697   * @param {HTMLElement} target Target that may be used to render content to.
29698   * @return {HTMLElement} The rendered element.
29699   */
29700  renderFrame(t, i) {
29701    const s = t.layerStatesArray[t.layerIndex], n = t.viewState, r = n.projection, o = n.resolution, a = n.center, l = n.rotation, h = t.pixelRatio, c = this.getLayer(), u = c.getSource(), d = u.getRevision(), f = u.getTileGridForProjection(r), g = f.getZForResolution(o, u.zDirection), _ = f.getResolution(g);
29702    let m = t.extent;
29703    const p = t.viewState.resolution, y = u.getTilePixelRatio(h), v = Math.round(mt(m) / p * h), E = Math.round(Yt(m) / p * h), C = s.extent && He(s.extent);
29704    C && (m = gs(
29705      m,
29706      He(s.extent)
29707    ));
29708    const w = _ * v / 2 / y, O = _ * E / 2 / y, R = [
29709      a[0] - w,
29710      a[1] - O,
29711      a[0] + w,
29712      a[1] + O
29713    ], j = f.getTileRangeForExtentAndZ(m, g), $ = {};
29714    $[g] = {};
29715    const V = this.createLoadedTileFinder(
29716      u,
29717      r,
29718      $
29719    ), tt = this.tmpExtent, J = this.tmpTileRange_;
29720    this.newTiles_ = !1;
29721    const St = l ? cl(
29722      n.center,
29723      p,
29724      l,
29725      t.size
29726    ) : void 0;
29727    for (let Vt = j.minX; Vt <= j.maxX; ++Vt)
29728      for (let pt = j.minY; pt <= j.maxY; ++pt) {
29729        if (l && !f.tileCoordIntersectsViewport([g, Vt, pt], St))
29730          continue;
29731        const vt = this.getTile(g, Vt, pt, t);
29732        if (this.isDrawableTile(vt)) {
29733          const Gt = ot(this);
29734          if (vt.getState() == H.LOADED) {
29735            $[g][vt.tileCoord.toString()] = vt;
29736            let Ht = vt.inTransition(Gt);
29737            Ht && s.opacity !== 1 && (vt.endTransition(Gt), Ht = !1), !this.newTiles_ && (Ht || !this.renderedTiles.includes(vt)) && (this.newTiles_ = !0);
29738          }
29739          if (vt.getAlpha(Gt, t.time) === 1)
29740            continue;
29741        }
29742        const Bt = f.getTileCoordChildTileRange(
29743          vt.tileCoord,
29744          J,
29745          tt
29746        );
29747        let oe = !1;
29748        Bt && (oe = V(g + 1, Bt)), oe || f.forEachTileCoordParentTileRange(
29749          vt.tileCoord,
29750          V,
29751          J,
29752          tt
29753        );
29754      }
29755    const K = _ / o * h / y;
29756    si(
29757      this.pixelTransform,
29758      t.size[0] / 2,
29759      t.size[1] / 2,
29760      1 / h,
29761      1 / h,
29762      l,
29763      -v / 2,
29764      -E / 2
29765    );
29766    const Y = wh(this.pixelTransform);
29767    this.useContainer(i, Y, this.getBackground(t));
29768    const L = this.context, W = L.canvas;
29769    fa(this.inversePixelTransform, this.pixelTransform), si(
29770      this.tempTransform,
29771      v / 2,
29772      E / 2,
29773      K,
29774      K,
29775      0,
29776      -v / 2,
29777      -E / 2
29778    ), W.width != v || W.height != E ? (W.width = v, W.height = E) : this.containerReused || L.clearRect(0, 0, v, E), C && this.clipUnrotated(L, t, C), u.getInterpolate() || (L.imageSmoothingEnabled = !1), this.preRender(L, t), this.renderedTiles.length = 0;
29779    let ut = Object.keys($).map(Number);
29780    ut.sort(ws);
29781    let ft, Tt, I;
29782    s.opacity === 1 && (!this.containerReused || u.getOpaque(t.viewState.projection)) ? ut = ut.reverse() : (ft = [], Tt = []);
29783    for (let Vt = ut.length - 1; Vt >= 0; --Vt) {
29784      const pt = ut[Vt], vt = u.getTilePixelSize(
29785        pt,
29786        h,
29787        r
29788      ), oe = f.getResolution(pt) / _, Gt = vt[0] * oe * K, Ht = vt[1] * oe * K, Ue = f.getTileCoordForCoordAndZ(
29789        Rs(R),
29790        pt
29791      ), Si = f.getTileCoordExtent(Ue), x = zt(this.tempTransform, [
29792        y * (Si[0] - R[0]) / _,
29793        y * (R[3] - Si[3]) / _
29794      ]), M = y * u.getGutterForProjection(r), b = $[pt];
29795      for (const T in b) {
29796        const S = (
29797          /** @type {import("../../ImageTile.js").default} */
29798          b[T]
29799        ), k = S.tileCoord, N = Ue[1] - k[1], F = Math.round(x[0] - (N - 1) * Gt), D = Ue[2] - k[2], P = Math.round(x[1] - (D - 1) * Ht), B = Math.round(x[0] - N * Gt), z = Math.round(x[1] - D * Ht), X = F - B, q = P - z, nt = g === pt, gt = nt && S.getAlpha(ot(this), t.time) !== 1;
29800        let ct = !1;
29801        if (!gt)
29802          if (ft) {
29803            I = [B, z, B + X, z, B + X, z + q, B, z + q];
29804            for (let bt = 0, Zt = ft.length; bt < Zt; ++bt)
29805              if (g !== pt && pt < Tt[bt]) {
29806                const kt = ft[bt];
29807                ee(
29808                  [B, z, B + X, z + q],
29809                  [kt[0], kt[3], kt[4], kt[7]]
29810                ) && (ct || (L.save(), ct = !0), L.beginPath(), L.moveTo(I[0], I[1]), L.lineTo(I[2], I[3]), L.lineTo(I[4], I[5]), L.lineTo(I[6], I[7]), L.moveTo(kt[6], kt[7]), L.lineTo(kt[4], kt[5]), L.lineTo(kt[2], kt[3]), L.lineTo(kt[0], kt[1]), L.clip());
29811              }
29812            ft.push(I), Tt.push(pt);
29813          } else
29814            L.clearRect(B, z, X, q);
29815        this.drawTileImage(
29816          S,
29817          t,
29818          B,
29819          z,
29820          X,
29821          q,
29822          M,
29823          nt
29824        ), ft && !gt ? (ct && L.restore(), this.renderedTiles.unshift(S)) : this.renderedTiles.push(S), this.updateUsedTiles(t.usedTiles, u, S);
29825      }
29826    }
29827    return this.renderedRevision = d, this.renderedResolution = _, this.extentChanged = !this.renderedExtent_ || !pn(this.renderedExtent_, R), this.renderedExtent_ = R, this.renderedPixelRatio = h, this.renderedProjection = r, this.manageTilePyramid(
29828      t,
29829      u,
29830      f,
29831      h,
29832      r,
29833      m,
29834      g,
29835      c.getPreload()
29836    ), this.scheduleExpireCache(t, u), this.postRender(L, t), s.extent && L.restore(), L.imageSmoothingEnabled = !0, Y !== W.style.transform && (W.style.transform = Y), this.container;
29837  }
29838  /**
29839   * @param {import("../../ImageTile.js").default} tile Tile.
29840   * @param {import("../../Map.js").FrameState} frameState Frame state.
29841   * @param {number} x Left of the tile.
29842   * @param {number} y Top of the tile.
29843   * @param {number} w Width of the tile.
29844   * @param {number} h Height of the tile.
29845   * @param {number} gutter Tile gutter.
29846   * @param {boolean} transition Apply an alpha transition.
29847   */
29848  drawTileImage(t, i, s, n, r, o, a, l) {
29849    const h = this.getTileImage(t);
29850    if (!h)
29851      return;
29852    const c = ot(this), u = i.layerStatesArray[i.layerIndex], d = u.opacity * (l ? t.getAlpha(c, i.time) : 1), f = d !== this.context.globalAlpha;
29853    f && (this.context.save(), this.context.globalAlpha = d), this.context.drawImage(
29854      h,
29855      a,
29856      a,
29857      h.width - 2 * a,
29858      h.height - 2 * a,
29859      s,
29860      n,
29861      r,
29862      o
29863    ), f && this.context.restore(), d !== u.opacity ? i.animate = !0 : l && t.endTransition(c);
29864  }
29865  /**
29866   * @return {HTMLCanvasElement} Image
29867   */
29868  getImage() {
29869    const t = this.context;
29870    return t ? t.canvas : null;
29871  }
29872  /**
29873   * Get the image from a tile.
29874   * @param {import("../../ImageTile.js").default} tile Tile.
29875   * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
29876   * @protected
29877   */
29878  getTileImage(t) {
29879    return t.getImage();
29880  }
29881  /**
29882   * @param {import("../../Map.js").FrameState} frameState Frame state.
29883   * @param {import("../../source/Tile.js").default} tileSource Tile source.
29884   * @protected
29885   */
29886  scheduleExpireCache(t, i) {
29887    if (i.canExpireCache()) {
29888      const s = (function(n, r, o) {
29889        const a = ot(n);
29890        a in o.usedTiles && n.expireCache(
29891          o.viewState.projection,
29892          o.usedTiles[a]
29893        );
29894      }).bind(null, i);
29895      t.postRenderFunctions.push(
29896        /** @type {import("../../Map.js").PostRenderFunction} */
29897        s
29898      );
29899    }
29900  }
29901  /**
29902   * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles.
29903   * @param {import("../../source/Tile.js").default} tileSource Tile source.
29904   * @param {import('../../Tile.js').default} tile Tile.
29905   * @protected
29906   */
29907  updateUsedTiles(t, i, s) {
29908    const n = ot(i);
29909    n in t || (t[n] = {}), t[n][s.getKey()] = !0;
29910  }
29911  /**
29912   * Manage tile pyramid.
29913   * This function performs a number of functions related to the tiles at the
29914   * current zoom and lower zoom levels:
29915   * - registers idle tiles in frameState.wantedTiles so that they are not
29916   *   discarded by the tile queue
29917   * - enqueues missing tiles
29918   * @param {import("../../Map.js").FrameState} frameState Frame state.
29919   * @param {import("../../source/Tile.js").default} tileSource Tile source.
29920   * @param {import("../../tilegrid/TileGrid.js").default} tileGrid Tile grid.
29921   * @param {number} pixelRatio Pixel ratio.
29922   * @param {import("../../proj/Projection.js").default} projection Projection.
29923   * @param {import("../../extent.js").Extent} extent Extent.
29924   * @param {number} currentZ Current Z.
29925   * @param {number} preload Load low resolution tiles up to `preload` levels.
29926   * @param {function(import("../../Tile.js").default):void} [tileCallback] Tile callback.
29927   * @protected
29928   */
29929  manageTilePyramid(t, i, s, n, r, o, a, l, h) {
29930    const c = ot(i);
29931    c in t.wantedTiles || (t.wantedTiles[c] = {});
29932    const u = t.wantedTiles[c], d = t.tileQueue, f = s.getMinZoom(), g = t.viewState.rotation, _ = g ? cl(
29933      t.viewState.center,
29934      t.viewState.resolution,
29935      g,
29936      t.size
29937    ) : void 0;
29938    let m = 0, p, y, v, E, C, w;
29939    for (w = f; w <= a; ++w)
29940      for (y = s.getTileRangeForExtentAndZ(o, w, y), v = s.getResolution(w), E = y.minX; E <= y.maxX; ++E)
29941        for (C = y.minY;
29941 C <= y.maxY; ++C)
29942          g && !s.tileCoordIntersectsViewport([w, E, C], _) || (a - w <= l ? (++m, p = i.getTile(w, E, C, n, r), p.getState() == H.IDLE && (u[p.getKey()] = !0, d.isKeyQueued(p.getKey()) || d.enqueue([
29943            p,
29944            c,
29945            s.getTileCoordCenter(p.tileCoord),
29946            v
29947          ])), h !== void 0 && h(p)) : i.useTile(w, E, C, r));
29948    i.updateCacheSize(m, r);
29949  }
29950}
29951const pS = mS;
29952class yS extends _S {
29953  /**
29954   * @param {import("./BaseTile.js").Options<TileSourceType>} [options] Tile layer options.
29955   */
29956  constructor(t) {
29957    super(t);
29958  }
29959  createRenderer() {
29960    return new pS(this);
29961  }
29962}
29963const xS = yS, hc = "EPSG:27700", vS = "#263746", ES = "#a1d0ca", MS = {
29964  "EPSG:27700": "EPSG:27700",
29965  27700: "EPSG:27700",
29966  "EPSG:4326": "EPSG:4326",
29967  4326: "EPSG:4326"
29968};
29969function e_(e) {
29970  return e == null ? null : MS[String(e).trim().toUpperCase()] || null;
29971}
29972const CS = /* @__PURE__ */ new Set([
29973  "FeatureCollection",
29974  "Feature",
29975  "Point",
29976  "MultiPoint",
29977  "LineString",
29978  "MultiLineString",
29979  "Polygon",
29980  "MultiPolygon",
29981  "GeometryCollection"
29982]);
29983function bS(e) {
29984  if (typeof e != "string" || !e.trim())
29985    return { ok: !1, message: "Invalid GeoJSON (empty response)" };
29986  let t;
29987  try {
29988    t = JSON.parse(e);
29989  } catch {
29990    return { ok: !1, message: "Invalid GeoJSON (not JSON)" };
29991  }
29992  return !t || typeof t != "object" || Array.isArray(t) || !CS.has(t.type) ? { ok: !1, message: 'Invalid GeoJSON (no recognised "type")' } : { ok: !0, object: t };
29993}
29994function wS(e, t) {
29995  var s, n;
29996  const i = e == null ? "" : String(e).trim();
29997  if (i)
29998    return e_(i);
29999  if (!((n = (s = t == null ? void 0 : t.crs) == null ? void 0 : s.properties) != null && n.name))
30000    return hc;
30001}
30002const jl = (e, t) => String(t).split(".").reduce((i, s) => i == null ? void 0 : i[s], e), ud = (e) => {
30003  if (typeof e == "number")
30004    return Number.isFinite(e) ? e : null;
30005  if (typeof e == "string" && e.trim() !== "") {
30006    const t = Number(e);
30007    return Number.isFinite(t) ? t : null;
30008  }
30009  return null;
30010};
30011function SS(e, { xField: t, yField: i } = {}) {
30012  const s = [];
30013  let n = 0;
30014  for (const r of e) {
30015    if (!r || typeof r != "object") {
30016      n++;
30017      continue;
30018    }
30019    const o = ud(jl(r, t)), a = ud(jl(r, i));
30020    if (o === null || a === null) {
30021      n++;
30022      continue;
30023    }
30024    const l = { ...r };
30025    delete l[t], delete l[i], s.push({ type: "Feature", properties: l, geometry: { type: "Point", coordinates: [o, a] } });
30026  }
30027  return { type: "FeatureCollection", features: s, skipped: n };
30028}
30029function TS(e, { xField: t, yField: i, recordsField: s } = {}) {
30030  const n = bS(e);
30031  if (n.ok)
30032    return { ok: !0, object: n.object, skipped: 0 };
30033  let r;
30034  try {
30035    r = JSON.parse(e);
30036  } catch {
30037    return n;
30038  }
30039  const o = s ? jl(r, s) : r;
30040  if (!Array.isArray(o))
30041    return s ? { ok: !1, message: `Invalid GeoJSON, and "${s}" is not an array of records` } : n;
30042  if (!t || !i)
30043    return { ok: !1, message: "Body is an array of records, not GeoJSON: set x-field and y-field to read it" };
30044  const a = SS(o, { xField: t, yField: i });
30045  return { ok: !0, object: a, skipped: a.skipped };
30046}
30047const RS = /* @__PURE__ */ new Set(["", "true", "1", "yes", "on"]), IS = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
30048function xs(e, t = !1) {
30049  if (e == null)
30050    return t;
30051  if (typeof e == "boolean")
30052    return e;
30053  const i = String(e).trim().toLowerCase();
30054  return RS.has(i) ? !0 : IS.has(i) ? !1 : t;
30055}
30056const dd = (e, t) => {
30057  const i = Number(e);
30058  return Number.isFinite(i) && i > 0 ? i : t;
30059};
30060function PS({ fillColor: e, strokeColor: t, strokeWidth: i, pointRadius: s, primary: n, secondary: r } = {}) {
30061  const o = n || vS, a = r || ES, l = t || o;
30062  return new pr({
30063    stroke: new vi({ color: l, width: dd(i, 2) }),
30064    fill: new Mi({ color: e || Yg(a, 0.35) }),
30065    image: new Fr({
30066      radius: dd(s, 6),
30067      fill: new Mi({ color: e || a }),
30068      stroke: new vi({ color: l, width: 2 })
30069    })
30070  });
30071}
30072function AS(e, { layer: t, projection: i } = {}) {
30073  const s = String(e ?? "").trim();
30074  if (!s)
30075    return s;
30076  const n = s.indexOf("#"), r = n === -1 ? s : s.slice(0, n), o = r.indexOf("?"), a = o === -1 ? r : r.slice(0, o), l = o === -1 ? "" : r.slice(o + 1), h = /* @__PURE__ */ new Map();
30077  for (const v of l.split("&")) {
30078    if (!v)
30079      continue;
30080    const E = v.indexOf("="), C = decodeURIComponent(E === -1 ? v : v.slice(0, E)).toLowerCase();
30081    h.set(C, E === -1 ? "" : v.slice(E + 1));
30082  }
30083  const c = /\/wfs\/?$/i.test(a), u = (h.get("service") || "").toLowerCase() === "wfs";
30084  if (!c && !u || h.has("request"))
30085    return s;
30086  const f = a.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i, "").replace(/\/+$/, "").split("/").filter(Boolean), g = c && f.length >= 3 ? f[f.length - 2] : "", _ = String(t ?? "").trim() || g, m = e_(i) || hc, p = [];
30087  h.has("service") || p.push("service=WFS"), h.has("version") || p.push("version=2.0.0"), p.push("request=GetFeature"), !h.has("typenames") && !h.has("typename") && _ && p.push(`typeNames=${encodeURIComponent(_)}`), h.has("outputformat") || p.push("outputFormat=application/json"), h.has("srsname") || p.push(`srsName=${encodeURIComponent(m)}`);
30088  const y = l ? l.endsWith("&") ? "" : "&" : "?";
30089  return `${a}${o === -1 ? "" : "?" + l}${o === -1 ? "?" : y}${p.join("&")}`.replace("??", "?");
30090}
30091const LS = {
30092  name: "XmapWebLayerWms",
30093  props: {
30094    url: {
30095      type: String,
30096      default: null
30097    },
30098    layer: {
30099      type: String,
30100      default: null
30101    },
30102    opacity: {
30103      type: Number,
30104      default: 100
30105    },
30106    // Boolean-as-string: Vue's custom-element wrapper only coerces Number props.
30107    tiled: {
30108      type: String,
30109      default: null
30110    },
30111    // Names the layer for <xmap-web-check layer="…">; set as the OL layer's `id`.
30112    layerId: {
30113      type: String,
30114      default: null
30115    }
30116  },
30117  created() {
30118    this.l = yn(this.buildLayer()), this.l.set("id", this.layerId || null);
30119  },
30120  methods: {
30121    isTiled() {
30122      return xs(this.tiled, !1);
30123    },
30124    buildLayer() {
30125      const e = this.opacity / 100, t = {
30126        projection: "EPSG:27700",
30127        url: this.url,
30128        params: { LAYERS: this.layer }
30129      };
30130      return this.isTiled() ? new xS({
30131        opacity: e,
30132        source: new aS({ ...t, params: { ...t.params, TILED: !0 } })
30133      }) : new fS({
30134        opacity: e,
30135        source: new Ww(t)
30136      });
30137    }
30138  },
30139  watch: {
30140    opacity(e) {
30141      this.l.setOpacity(e / 100);
30142    },
30143    layerId(e) {
30144      this.l.set("id", e || null);
30145    }
30146  },
30147  mounted() {
30148    this.$parent.map.addLayer(this.l);
30149  }
30150}, OS = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit", FS = "https://challenges.cloudflare.com/turnstile/";
30151let zn = null;
30152function kS(e = globalThis.document, t = globalThis.window) {
30153  return t && t.turnstile ? Promise.resolve(t.turnstile) : zn || (zn = new Promise((i, s) => {
30154    const n = e.querySelector(`script[src^="${FS}"]`), r = n || e.createElement("script");
30155    n || (r.src = OS, r.async = !0, r.defer = !0), r.addEventListener("load", () => {
30156      t.turnstile ? i(t.turnstile) : s(new Error("Turnstile script loaded but window.turnstile is missing"));
30157    }), r.addEventListener("error", () => {
30158      zn = null, s(new Error("Turnstile script failed to load"));
30159    }), n || e.head.appendChild(r);
30160  }), zn);
30161}
30162const DS = `.xmap-report-form{display:flex;flex-direction:column;gap:8px;font-family:Roboto,system-ui,sans-serif;color:#1a1a1a}.xrf-fields{display:flex;flex-direction:column;gap:8px}
30162.xrf-field{display:flex;flex-direction:column;gap:4px}.xrf-field label{font-size:13px;font-weight:600}.xrf-field input,.xrf-field textarea,.xrf-field select{font:inherit;padding:6px 8px;border:1px solid #b3bcc4;border-radius:4px}.xmap-report-form button{font:inherit;font-weight:600;padding:9px 14px;border:0;border-radius:4px;background:#263746;color:#fff;cursor:pointer;align-self:flex-start}.xmap-report-form button:disabled{background:#9aa7b1;cursor:not-allowed}.xrf-hint{font-size:12px;color:#505a62;margin:0}.xrf-hint.error{color:#d4351c}::slotted(.xrf-turnstile){display:block;min-height:65px}.xrf-status{font-size:13px;min-height:1.2em;margin:0}.xrf-status.error{color:#d4351c}.xrf-status.ok{color:#00703c}
30163`, NS = "https://api.hub.xmap.cloud", GS = "cf-turnstile-response", zS = "turnstile_failed", jS = "Please wait for the security check to finish, then try again.", WS = "We could not verify your browser. Please try again.", BS = "The security check could not load. Please refresh the page and try again.", US = {
30164  name: "XmapReportForm",
30165  emits: ["xmap-report-submitted", "xmap-report-error"],
30166  props: {
30167    customer: { type: String, default: null },
30168    target: { type: String, default: null },
30169    apiBase: { type: String, default: NS },
30170    geometryField: { type: String, default: "geometry" },
30171    // Declarative schema. Accepts an Array (JS property) or a JSON string (attribute).
30172    fields: { type: [Array, String], default: () => [] },
30173    submitLabel: { type: String, default: "Submit report" },
30174    // Keep the drawn geometry on the map after a successful submit. Default false
30175    // preserves the existing clear-on-submit behaviour for navigate-away flows;
30176    // set it when the host prefills a form on the same page, so the citizen's
30177    // geometry does not vanish while they are still filling fields in.
30178    keepGeometry: { type: Boolean, default: !1 },
30179    // Cloudflare Turnstile site key (public). When set, a widget is rendered above
30180    // the button and submission is refused until a token exists (XMP-2294). The
30181    // Hub verifies the token server-side; a missing/replayed token is a 403.
30182    turnstileSiteKey: { type: String, default: null }
30183  },
30184  data() {
30185    return {
30186      slotMode: !1,
30187      submitting: !1,
30188      status: "",
30189      statusKind: "",
30190      turnstileToken: null,
30191      turnstileWidgetId: null,
30192      turnstileState: "idle"
30193      // idle | loading | ready | error
30194    };
30195  },
30196  computed: {
30197    hasPoint() {
30198      return ne.hasPoint;
30199    },
30200    parsedFields() {
30201      if (Array.isArray(this.fields))
30202        return this.fields;
30203      if (typeof this.fields == "string" && this.fields.trim())
30204        try {
30205          return JSON.parse(this.fields);
30206        } catch {
30207          return [];
30208        }
30209      return [];
30210    },
30211    turnstileEnabled() {
30212      return !!(this.turnstileSiteKey && String(this.turnstileSiteKey).trim());
30213    },
30214    canSubmit() {
30215      return !this.submitting && this.hasPoint && (!this.turnstileEnabled || !!this.turnstileToken);
30216    },
30217    turnstileHint() {
30218      return !this.turnstileEnabled || this.turnstileToken ? "" : this.turnstileState === "error" ? BS : "Checking your browser…";
30219    }
30220  },
30221  watch: {
30222    // `immediate` covers a key present at mount; the watcher itself covers hosts
30223    // that bind the key from config loaded after mount (the Hub does).
30224    turnstileSiteKey: {
30225      immediate: !0,
30226      handler() {
30227        this.mountTurnstile();
30228      }
30229    }
30230  },
30231  mounted() {
30232    const e = this.hostEl();
30233    this.slotMode = !!(e && e.querySelectorAll("[name]").length);
30234  },
30235  beforeUnmount() {
30236    this.removeTurnstile();
30237  },
30238  methods: {
30239    hostEl() {
30240      var e, t, i;
30241      return ((i = (t = (e = this.$el) == null ? void 0 : e.getRootNode) == null ? void 0 : t.call(e)) == null ? void 0 : i.host) || null;
30242    },
30243    collectFields() {
30244      const e = {};
30245      return ((i) => {
30246        i && i.querySelectorAll("[name]").forEach((s) => {
30247          const n = s.getAttribute("name");
30248          n && (e[n] = s.type === "checkbox" ? s.checked : s.value);
30249        });
30250      })(this.slotMode ? this.hostEl() : this.$refs.form), e;
30251    },
30252    validate() {
30253      if (this.slotMode) {
30254        const e = this.hostEl();
30255        return e ? [...e.querySelectorAll("[name]")].every(
30256          (t) => typeof t.reportValidity == "function" ? t.reportValidity() : !0
30257        ) : !0;
30258      }
30259      return this.$refs.form.reportValidity();
30260    },
30261    async onSubmit() {
30262      var t;
30263      if (this.submitting)
30264        return;
30265      if (!this.customer || !this.target) {
30266        this.fail('Misconfigured: "customer" and "target" are required.');
30267        return;
30268      }
30269      if (!ne.hasPoint) {
30270        this.fail("Please add a location on the map first.");
30271        return;
30272      }
30273      if (!this.validate())
30274        return;
30275      if (this.turnstileEnabled && !this.turnstileToken) {
30276        this.fail(jS);
30277        return;
30278      }
30279      const e = {
30280        ...this.collectFields(),
30281        [this.geometryField]: ne.geometry
30282      };
30283      this.turnstileEnabled && (e[GS] = this.turnstileToken), this.submitting = !0, this.setStatus("Submitting…", "");
30284      try {
30285        const i = await fetch(`${this.apiBase}/${this.customer}/report/${this.target}`, {
30286          method: "POST",
30287          headers: { "content-type": "application/json" },
30288          body: JSON.stringify(e)
30289        }), s = await i.json().catch(() => ({}));
30290        if (!i.ok) {
30291          if (s.code === zS) {
30292            this.fail(WS, i.status, s.code);
30293            return;
30294          }
30295          this.fail(s.error || `Submission failed (${i.status})`, i.status, s.code);
30296          return;
30297        }
30298        const n = ((t = s.data) == null ? void 0 : t[0]) ?? {}, r = ne.geometry ? JSON.parse(JSON.stringify(ne.geometry)) : null;
30299        this.setStatus("Report submitted. Thank you.", "ok"), this.emitHost("xmap-report-submitted", {
30300          id: n.id ?? null,
30301          // The Hub aliases its columns on the way out: target_pk_value -> object_id,
30302          // geom_stats -> metadata (report-queries.js:30). Read the wire names.
30303          targetPk: n.object_id ?? null,
30304          // PK of the row created in the council's layer
30305          stats: n.metadata ?? null,
30306          // geometry stats derived server-side
30307          geometry: r
30308        }), this.keepGeometry || Vb();
30309      } catch (i) {
30310        this.fail(i.message || "Network error");
30311      } finally {
30312        this.submitting = !1, this.turnstileEnabled && this.resetTurnstile();
30313      }
30314    },
30315    // --- Turnstile -------------------------------------------------------------
30316    async mountTurnstile() {
30317      if (this.removeTurnstile(), !this.turnstileEnabled)
30318        return;
30319      this.turnstileState = "loading";
30320      const e = this.turnstileSiteKey;
30321      try {
30322        await this.$nextTick();
30323        const t = await kS();
30324        if (e !== this.turnstileSiteKey)
30325          return;
30326        const i = this.ensureTurnstileContainer();
30327        if (!i)
30328          return;
30329        this.turnstileWidgetId = t.render(i, {
30330          sitekey: e,
30331          // We hold the token in state and add it to the body ourselves, so slot
30332          // and schema mode behave identically. Cloudflare's hidden input would
30333          // otherwise be harvested by collectFields() in one mode and not the other.
30334          "response-field": !1,
30335          callback: (s) => {
30336            this.turnstileToken = s, this.turnstileState = "ready";
30337          },
30338          "expired-callback": () => {
30339            this.turnstileToken = null;
30340          },
30341          "timeout-callback": () => {
30342            this.turnstileToken = null;
30343          },
30344          "error-callback": () => {
30345            this.turnstileToken = null, this.turnstileState = "error";
30346          }
30347        });
30348      } catch {
30349        this.turnstileToken = null, this.turnstileState = "error";
30350      }
30351    },
30352    // Light-DOM container for the widget (see the template comment). The div goes on
30353    // the host element and is projected through the default <slot>. It carries no
30354    // `name`, so slot-mode harvesting and the slotMode check ignore it.
30355    ensureTurnstileContainer() {
30356      const e = this.hostEl();
30357      if (!e)
30358        return null;
30359      let t = e.querySelector(":scope > .xrf-turnstile");
30360      return t || (t = e.ownerDocument.createElement("div"), t.className = "xrf-turnstile", t.setAttribute("data-xmap-turnstile", ""), e.appendChild(t)), t;
30361    },
30362    resetTurnstile() {
30363      var t;
30364      this.turnstileToken = null;
30365      const e = (t = globalThis.window) == null ? void 0 : t.turnstile;
30366      if (e && this.turnstileWidgetId != null)
30367        try {
30368          e.reset(this.turnstileWidgetId);
30369        } catch {
30370        }
30371    },
30372    removeTurnstile() {
30373      var i, s;
30374      this.turnstileToken = null;
30375      const e = (i = globalThis.window) == null ? void 0 : i.turnstile;
30376      if (e && this.turnstileWidgetId != null)
30377        try {
30378          e.remove(this.turnstileWidgetId);
30379        } catch {
30380        }
30381      this.turnstileWidgetId = null, this.turnstileState = "idle";
30382      const t = this.hostEl();
30383      (s = t == null ? void 0 : t.querySelector(":scope > .xrf-turnstile")) == null || s.remove();
30384    },
30385    fail(e, t, i) {
30386      this.setStatus(e, "error");
30387      const s = { status: t, message: e };
30388      i && (s.code = i), this.emitHost("xmap-report-error", s);
30389    },
30390    setStatus(e, t) {
30391      this.status = e, this.statusKind = t;
30392    },
30393    emitHost(e, t) {
30394      const i = this.hostEl() || this.$el;
30395      i == null || i.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
30396    }
30397  }
30398}, XS = {
30399  key: 0,
30400  class: "xrf-fields"
30401}, $S = ["for"], YS = { key: 0 }, KS = ["id", "name", "required", "placeholder"], qS = ["id", "name", "required"], VS = ["value"], HS = ["id", "name", "required"], ZS = ["type", "id", "name", "required", "placeholder", "pattern"], JS = ["disabled"], QS = {
30402  key: 1,
30403  class: "xrf-hint"
30404};
30405function tT(e, t, i, s, n, r) {
30406  return wt(), It("form", {
30407    ref: "form",
30408    class: "xmap-report-form",
30409    onSubmit: t[0] || (t[0] = Yf((...o) => r.onSubmit && r.onSubmit(...o), ["prevent"]))
30410  }, [
30411    n.slotMode ? qi("", !0) : (wt(), It("div", XS, [
30412      (wt(!0), It(me, null, vl(r.parsedFields, (o) => (wt(), It("div", {
30413        key: o.name,
30414        class: "xrf-field"
30415      }, [
30416        Nt("label", {
30417          for: `xrf-${o.name}`
30418        }, [
30419          Uf(fi(o.label || o.name), 1),
30420          o.required ? (wt(), It("span", YS, " *")) : qi("", !0)
30421        ], 8, $S),
30422        o.type === "textarea" ? (wt(), It("textarea", {
30423          key: 0,
30424          id: `xrf-${o.name}`,
30425          name: o.name,
30426          required: !!o.required,
30427          placeholder: o.placeholder || ""
30428        }, null, 8, KS)) : o.type === "select" ? (wt(), It("select", {
30429          key: 1,
30430          id: `xrf-${o.name}`,
30431          name: o.name,
30432          required: !!o.required
30433        }, [
30434          (wt(!0), It(me, null, vl(o.options || [], (a) => (wt(), It("option", {
30435            key: a,
30436            value: a
30437          }, fi(a), 9, VS))), 128))
30438        ], 8, qS)) : o.type === "checkbox" ? (wt(), It("input", {
30439          key: 2,
30440          type: "checkbox",
30441          id: `xrf-${o.name}`,
30442          name: o.name,
30443          required: !!o.required
30444        }, null, 8, HS)) : (wt(), It("input", {
30445          key: 3,
30446          type: o.type || "text",
30447          id: `xrf-${o.name}`,
30448          name: o.name,
30449          required: !!o.required,
30450          placeholder: o.placeholder || "",
30451          pattern: o.pattern || null
30452        }, null, 8, ZS))
30453      ]))), 128))
30454    ])),
30455    If(e.$slots, "default"),
30456    Nt("button", {
30457      type: "submit",
30458      disabled: !r.canSubmit
30459    }, fi(n.submitting ? "Submitting…" : i.submitLabel), 9, JS),
30460    r.hasPoint ? r.turnstileHint ? (wt(), It("p", {
30461      key: 2,
30462      class: bs(["xrf-hint", { error: n.turnstileState === "error" }])
30463    }, fi(r.turnstileHint), 3)) : qi("", !0) : (wt(), It("p", QS, "Add a location on the map to enable submission.")),
30464    Nt("p", {
30465      class: bs(["xrf-status", n.statusKind])
30466    }, fi(n.status), 3)
30467  ], 544);
30468}
30469const eT = /* @__PURE__ */ ca(US, [["render", tT], ["styles", [DS]]]), i_ = "https://search.xmap.cloud", s_ = { llpg: "llpg/v2", ngd: "
30469ngd" };
30470function n_(e) {
30471  const t = String(e || "").toLowerCase();
30472  return s_[t] ? t : "llpg";
30473}
30474function iT(e, t, i, s = "llpg") {
30475  const n = String(e || i_).replace(/\/+$/, ""), r = s_[n_(s)];
30476  return `${n}/${encodeURIComponent(t)}/${r}?query=${encodeURIComponent(i)}`;
30477}
30478function sT(e) {
30479  if (!e)
30480    return null;
30481  const t = (n) => n == null || n === "" ? NaN : Number(n), i = t(e.easting), s = t(e.northing);
30482  return !Number.isFinite(i) || !Number.isFinite(s) ? null : {
30483    address: e.postal_address || "",
30484    uprn: e.uprn != null ? String(e.uprn) : null,
30485    usrn: e.usrn != null ? String(e.usrn) : null,
30486    postcode: e.postcode || null,
30487    easting: i,
30488    northing: s,
30489    geometry: { type: "Point", coordinates: [i, s] }
30490  };
30491}
30492function nT(e) {
30493  var i, s;
30494  const t = ((i = e == null ? void 0 : e.data) == null ? void 0 : i.status) ?? (e == null ? void 0 : e.status);
30495  return t && t !== "success" ? ((s = e == null ? void 0 : e.data) == null ? void 0 : s.message) || (e == null ? void 0 : e.message) || `Search failed (${t})` : null;
30496}
30497function rT(e) {
30498  return /key\s*fail|access key/i.test(String(e || ""));
30499}
30500function oT(e, t = 10) {
30501  var n;
30502  const i = (n = e == null ? void 0 : e.data) == null ? void 0 : n.lpi;
30503  if (!Array.isArray(i))
30504    return [];
30505  const s = [];
30506  for (const r of i) {
30507    const o = sT(r);
30508    if (o && s.push(o), s.length >= t)
30509      break;
30510  }
30511  return s;
30512}
30513const aT = `.xmap-address-search{position:relative;font-family:Roboto,system-ui,sans-serif;color:#1a1a1a;text-align:left}.xas-row{display:flex;gap:6px}.xmap-address-search input{font:inherit;flex:1 1 auto;min-width:0;box-sizing:border-box;padding:6px 8px;border:1px solid #b3bcc4;border-radius:4px}.xas-button{font:inherit;font-weight:600;padding:6px 12px;border:0;border-radius:4px;background:#263746;color:#fff;cursor:pointer;white-space:nowrap}.xas-button:disabled{background:#9aa7b1;cursor:not-allowed}.xas-list{position:absolute;z-index:10;left:0;right:0;margin:2px 0 0;padding:0;list-style:none;max-height:240px;overflow-y:auto;background:#fff;border:1px solid #b3bcc4;border-radius:4px;box-shadow:0 4px 12px #0000001f;font-size:13px}.xas-list li{padding:6px 8px;cursor:pointer}.xas-list li.active{background:#263746;color:#fff}.xas-note{color:#505a62;cursor:default}.xas-error{color:#d4351c}
30514`, lT = {
30515  name: "XmapAddressSearch",
30516  emits: ["xmap-address-selected", "xmap-address-error"],
30517  props: {
30518    apiBase: { type: String, default: i_ },
30519    apiKey: { type: String, default: null },
30520    // Which gazetteer to query: "llpg" (default) or "ngd".
30521    source: { type: String, default: "llpg" },
30522    // "submit" (default): search on Enter or the Search button.
30523    // "typeahead": search as the user types (debounced).
30524    mode: { type: String, default: "submit" },
30525    // Client-side cap: llpg/v2 ignores its limit param.
30526    limit: { type: [Number, String], default: 10 },
30527    minChars: { type: [Number, String], default: 3 },
30528    placeholder: { type: String, default: "Search for an address" },
30529    searchLabel: { type: String, default: "Search" },
30530    // Typeahead only. Also guards the explicit path against double-fires
30531    // (Enter then an immediate click) by collapsing them into one request.
30532    debounce: { type: [Number, String], default: 300 }
30533  },
30534  data() {
30535    return {
30536      text: "",
30537      suggestions: [],
30538      activeIndex: -1,
30539      open: !1,
30540      loading: !1,
30541      error: "",
30542      _timer: null,
30543      _controller: null
30544    };
30545  },
30546  computed: {
30547    activeId() {
30548      return this.activeIndex >= 0 ? `xas-opt-${this.activeIndex}` : null;
30549    },
30550    isTypeahead() {
30551      return String(this.mode).toLowerCase() === "typeahead";
30552    },
30553    canSearch() {
30554      return this.text.trim().length >= Number(this.minChars);
30555    },
30556    sourceKey() {
30557      return n_(this.source);
30558    }
30559  },
30560  methods: {
30561    hostEl() {
30562      var e, t, i;
30563      return ((i = (t = (e = this.$el) == null ? void 0 : e.getRootNode) == null ? void 0 : t.call(e)) == null ? void 0 : i.host) || null;
30564    },
30565    emitHost(e, t) {
30566      const i = this.hostEl() || this.$el;
30567      i == null || i.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
30568    },
30569    onInput(e) {
30570      if (this.text = e.target.value, this.activeIndex = -1, clearTimeout(this._timer), !this.canSearch) {
30571        this.abort(), this.suggestions = [], this.open = !1;
30572        return;
30573      }
30574      if (!this.isTypeahead) {
30575        this.suggestions = [], this.open = !1;
30576        return;
30577      }
30578      this.scheduleSearch();
30579    },
30580    // Every search goes through one debounced timer, so rapid triggers
30581    // (keystrokes in typeahead, Enter + click in submit mode) coalesce.
30582    scheduleSearch() {
30583      clearTimeout(this._timer), this._timer = setTimeout(() => this.search(this.text.trim()), Number(this.debounce));
30584    },
30585    submitSearch() {
30586      this.canSearch && this.scheduleSearch();
30587    },
30588    onFocus() {
30589      this.suggestions.length && (this.open = !0);
30590    },
30591    onBlur() {
30592      setTimeout(() => {
30593        this.open = !1;
30594      }, 120);
30595    },
30596    onKeydown(e) {
30597      const t = this.open && this.suggestions.length > 0;
30598      if (e.key === "Escape") {
30599        this.open = !1;
30600        return;
30601      }
30602      if (e.key === "Enter") {
30603        e.preventDefault(), t && (this.activeIndex >= 0 || this.isTypeahead) ? this.select(this.suggestions[Math.max(this.activeIndex, 0)]) : this.submitSearch();
30604        return;
30605      }
30606      if (!t)
30607        return;
30608      const i = this.suggestions.length;
30609      e.key === "ArrowDown" ? (e.preventDefault(), this.activeIndex = (this.activeIndex + 1) % i) : e.key === "ArrowUp" && (e.preventDefault(), this.activeIndex = (this.activeIndex - 1 + i) % i);
30610    },
30611    abort() {
30612      this._controller && (this._controller.abort(), this._controller = null), this.loading = !1;
30613    },
30614    async search(e) {
30615      if (!this.apiKey) {
30616        this.error = 'Misconfigured: "api-key" is required.', this.open = !0, this.emitHost("xmap-address-error", { message: this.error });
30617        return;
30618      }
30619      this.abort();
30620      const t = new AbortController();
30621      this._controller = t, this.loading = !0, this.error = "", this.open = !0;
30622      try {
30623        const i = await fetch(iT(this.apiBase, this.apiKey, e, this.sourceKey), { signal: t.signal }), s = await i.json().catch(() => ({}));
30624        if (t.signal.aborted)
30625          return;
30626        if (!i.ok) {
30627          this.fail(s.message || `Search failed (${i.status})`, i.status);
30628          return;
30629        }
30630        const n = nT(s);
30631        if (n) {
30632          this.fail(rT(n) ? "Address search is not configured correctly (invalid API key)." : n, i.status);
30633          return;
30634        }
30635        this.suggestions = oT(s, Number(this.limit)), this.activeIndex = -1;
30636      } catch (i) {
30637        if (i.name === "AbortError")
30638          return;
30639        this.fail(i.message || "Network error");
30640      } finally {
30641        this._controller === t && (this._controller = null, this.loading = !1);
30642      }
30643    },
30644    fail(e, t) {
30645      this.suggestions = [], this.error = e, this.emitHost("xmap-address-error", { status: t, message: e });
30646    },
30647    select(e) {
30648      e && (this.text = e.address, this.open = !1, this.suggestions = [e], this.activeIndex = 0, this.emitHost("xmap-address-selected", JSON.parse(JSON.stringify(e))));
30649    }
30650  },
30651  beforeUnmount() {
30652    clearTimeout(this._timer), this.abort();
30653  }
30654}, hT = ["aria-expanded"], cT = { class: "xas-row" }, uT = ["placeholder", "value", "aria-activedescendant"], dT = ["disabled"], fT = {
30655  key: 0,
30656  id: "xas-list",
30657  class: "xas-list",
30658  role: "listbox"
30659}, gT = {
30660  key: 0,
30661  class: "xas-note"
30662}, _T = {
30663  key: 1,
30664  class: "xas-note xas-error"
30665}, mT = {
30666  key: 2,
30667  class: "xas-note"
30668}, pT = ["id", "aria-selected", "onMousedown", "onMousemove"];
30669function yT(e, t, i, s, n, r) {
30670  return wt(), It("div", {
30671    class: "xmap-address-search",
30672    role: "combobox",
30673    "aria-expanded": n.open ? "true" : "false",
30674    "aria-haspopup": "listbox",
30675    "aria-owns": "xas-list"
30676  }, [
30677    Nt("div", cT, [
30678      Nt("input", {
30679        ref: "input",
30680        type: "text",
30681        autocomplete: "off",
30682        spellcheck: "false",
30683        maxlength: "100",
30684        placeholder: i.placeholder,
30685        value: n.text,
30686        "aria-activedescendant": r.activeId,
30687        "aria-autocomplete": "list",
30688        "aria-controls": "xas-list",
30689        onInput: t[0] || (t[0] = (...o) => r.onInput && r.onInput(...o)),
30690        onKeydown: t[1] || (t[1] = (...o) => r.onKeydown && r.onKeydown(...o)),
30691        onFocus: t[2] || (t[2] = (...o) => r.onFocus && r.onFocus(...o)),
30692        onBlur: t[3] || (t[3] = (...o) => r.onBlur && r.onBlur(...o))
30693      }, null, 40, uT),
30694      r.isTypeahead ? qi("", !0) : (wt(), It("button", {
30695        key: 0,
30696        type: "button",
30697        class: "xas-button",
30698        disabled: n.loading || !r.canSearch,
30699        onClick: t[4] || (t[4] = (o) => r.submitSearch())
30700      }, fi(i.searchLabel), 9, dT))
30701    ]),
30702    n.open ? (wt(), It("ul", fT, [
30703      n.loading ? (wt(), It("li", gT, "Searching…")) : n.error ? (wt(), It("li", _T, fi(n.error), 1)) : n.suggestions.length ? qi("", !0) : (wt(), It("li", mT, "No addresses found")),
30704      (wt(!0), It(me, null, vl(n.suggestions, (o, a) => (wt(), It("li", {
30705        key: o.uprn || a,
30706        id: `xas-opt-${a}`,
30707        role: "option",
30708        class: bs({ active: a === n.activeIndex }),
30709        "aria-selected": a === n.activeIndex ? "true" : "false",
30710        onMousedown: Yf((l) => r.select(o), ["prevent"]),
30711        onMousemove: (l) => n.activeIndex = a
30712      }, fi(o.address), 43, pT))), 128))
30713    ])) : qi("", !0)
30714  ], 8, hT);
30715}
30716const xT = /* @__PURE__ */ ca(lT, [["render", yT], ["styles", [aT]]]);
30717class vT {
30718  constructor() {
30719    this.dataProjection = void 0, this.defaultFeatureProjection = void 0, this.supportedMediaTypes = null;
30720  }
30721  /**
30722   * Adds the data projection to the read options.
30723   * @param {Document|Element|Object|string} source Source.
30724   * @param {ReadOptions} [options] Options.
30725   * @return {ReadOptions|undefined} Options.
30726   * @protected
30727   */
30728  getReadOptions(t, i) {
30729    if (i) {
30730      let s = i.dataProjection ? Rt(i.dataProjection) : this.readProjection(t);
30731      i.extent && s && s.getUnits() === "tile-pixels" && (s = Rt(s), s.setWorldExtent(i.extent)), i = {
30732        dataProjection: s,
30733        featureProjection: i.featureProjection
30734      };
30735    }
30736    return this.adaptOptions(i);
30737  }
30738  /**
30739   * Sets the `dataProjection` on the options, if no `dataProjection`
30740   * is set.
30741   * @param {WriteOptions|ReadOptions|undefined} options
30742   *     Options.
30743   * @protected
30744   * @return {WriteOptions|ReadOptions|undefined}
30745   *     Updated options.
30746   */
30747  adaptOptions(t) {
30748    return Object.assign(
30749      {
30750        dataProjection: this.dataProjection,
30751        featureProjection: this.defaultFeatureProjection
30752      },
30753      t
30754    );
30755  }
30756  /**
30757   * @abstract
30758   * @return {Type} The format type.
30759   */
30760  getType() {
30761    return Z();
30762  }
30763  /**
30764   * Read a single feature from a source.
30765   *
30766   * @abstract
30767   * @param {Document|Element|Object|string} source Source.
30768   * @param {ReadOptions} [options] Read options.
30769   * @return {import("../Feature.js").FeatureLike} Feature.
30770   */
30771  readFeature(t, i) {
30772    return Z();
30773  }
30774  /**
30775   * Read all features from a source.
30776   *
30777   * @abstract
30778   * @param {Document|Element|ArrayBuffer|Object|string} source Source.
30779   * @param {ReadOptions} [options] Read options.
30780   * @return {Array<import("../Feature.js").FeatureLike>} Features.
30781   */
30782  readFeatures(t, i) {
30783    return Z();
30784  }
30785  /**
30786   * Read a single geometry from a source.
30787   *
30788   * @abstract
30789   * @param {Document|Element|Object|string} source Source.
30790   * @param {ReadOptions} [options] Read options.
30791   * @return {import("../geom/Geometry.js").default} Geometry.
30792   */
30793  readGeometry(t, i) {
30794    return Z();
30795  }
30796  /**
30797   * Read the projection from a source.
30798   *
30799   * @abstract
30800   * @param {Document|Element|Object|string} source Source.
30801   * @return {import("../proj/Projection.js").default|undefined} Projection.
30802   */
30803  readProjection(t) {
30804    return Z();
30805  }
30806  /**
30807   * Encode a feature in this format.
30808   *
30809   * @abstract
30810   * @param {import("../Feature.js").default} feature Feature.
30811   * @param {WriteOptions} [options] Write options.
30812   * @return {string|ArrayBuffer} Result.
30813   */
30814  writeFeature(t, i) {
30815    return Z();
30816  }
30817  /**
30818   * Encode an array of features in this format.
30819   *
30820   * @abstract
30821   * @param {Array<import("../Feature.js").default>} features Features.
30822   * @param {WriteOptions} [options] Write options.
30823   * @return {string|ArrayBuffer} Result.
30824   */
30825  writeFeatures(t, i) {
30826    return Z();
30827  }
30828  /**
30829   * Write a single geometry in this format.
30830   *
30831   * @abstract
30832   * @param {import("../geom/Geometry.js").default} geometry Geometry.
30833   * @param {WriteOptions} [options] Write options.
30834   * @return {string|ArrayBuffer} Result.
30835   */
30836  writeGeometry(t, i) {
30837    return Z();
30838  }
30839}
30840function r_(e, t, i) {
30841  const s = i ? Rt(i.featureProjection) : null, n = i ? Rt(i.dataProjection) : null;
30842  let r;
30843  if (s && n && !di(s, n) ? r = (t ? e.clone() : e).transform(
30844    t ? s : n,
30845    t ? n : s
30846  ) : r = e, t && i && /** @type {WriteOptions} */
30847  i.decimals !== void 0) {
30848    const o = Math.pow(
30849      10,
30850      /** @type {WriteOptions} */
30851      i.decimals
30852    ), a = function(l) {
30853      for (let h = 0, c = l.length; h < c; ++h)
30854        l[h] = Math.round(l[h] * o) / o;
30855      return l;
30856    };
30857    r === e && (r = e.clone()), r.applyTransform(a);
30858  }
30859  return r;
30860}
30861class ET extends vT {
30862  constructor() {
30863    super();
30864  }
30865  /**
30866   * @return {import("./Feature.js").Type} Format.
30867   */
30868  getType() {
30869    return "json";
30870  }
30871  /**
30872   * Read a feature.  Only works for a single feature. Use `readFeatures` to
30873   * read a feature collection.
30874   *
30875   * @param {ArrayBuffer|Document|Element|Object|string} source Source.
30876   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30877   * @return {import("../Feature.js").default} Feature.
30878   * @api
30879   */
30880  readFeature(t, i) {
30881    return this.readFeatureFromObject(
30882      ho(t),
30883      this.getReadOptions(t, i)
30884    );
30885  }
30886  /**
30887   * Read all features.  Works with both a single feature and a feature
30888   * collection.
30889   *
30890   * @param {ArrayBuffer|Document|Element|Object|string} source Source.
30891   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30892   * @return {Array<import("../Feature.js").default>} Features.
30893   * @api
30894   */
30895  readFeatures(t, i) {
30896    return this.readFeaturesFromObject(
30897      ho(t),
30898      this.getReadOptions(t, i)
30899    );
30900  }
30901  /**
30902   * @abstract
30903   * @param {Object} object Object.
30904   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30905   * @protected
30906   * @return {import("../Feature.js").default} Feature.
30907   */
30908  readFeatureFromObject(t, i) {
30909    return Z();
30910  }
30911  /**
30912   * @abstract
30913   * @param {Object} object Object.
30914   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30915   * @protected
30916   * @return {Array<import("../Feature.js").default>} Features.
30917   */
30918  readFeaturesFromObject(t, i) {
30919    return Z();
30920  }
30921  /**
30922   * Read a geometry.
30923   *
30924   * @param {ArrayBuffer|Document|Element|Object|string} source Source.
30925   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30926   * @return {import("../geom/Geometry.js").default} Geometry.
30927   * @api
30928   */
30929  readGeometry(t, i) {
30930    return this.readGeometryFromObject(
30931      ho(t),
30932      this.getReadOptions(t, i)
30933    );
30934  }
30935  /**
30936   * @abstract
30937   * @param {Object} object Object.
30938   * @param {import("./Feature.js").ReadOptions} [options] Read options.
30939   * @protected
30940   * @return {import("../geom/Geometry.js").default} Geometry.
30941   */
30942  readGeometryFromObject(t, i) {
30943    return Z();
30944  }
30945  /**
30946   * Read the projection.
30947   *
30948   * @param {ArrayBuffer|Document|Element|Object|string} source Source.
30949   * @return {import("../proj/Projection.js").default} Projection.
30950   * @api
30951   */
30952  readProjection(t) {
30953    return this.readProjectionFromObject(ho(t));
30954  }
30955  /**
30956   * @abstract
30957   * @param {Object} object Object.
30958   * @protected
30959   * @return {import("../proj/Projection.js").default} Projection.
30960   */
30961  readProjectionFromObject(t) {
30962    return Z();
30963  }
30964  /**
30965   * Encode a feature as string.
30966   *
30967   * @param {import("../Feature.js").default} feature Feature.
30968   * @param {import("./Feature.js").WriteOptions} [options] Write options.
30969   * @return {string} Encoded feature.
30970   * @api
30971   */
30972  writeFeature(t, i) {
30973    return JSON.stringify(this.writeFeatureObject(t, i));
30974  }
30975  /**
30976   * @abstract
30977   * @param {import("../Feature.js").default} feature Feature.
30978   * @param {import("./Feature.js").WriteOptions} [options] Write options.
30979   * @return {Object} Object.
30980   */
30981  writeFeatureObject(t, i) {
30982    return Z();
30983  }
30984  /**
30985   * Encode an array of features as string.
30986   *
30987   * @param {Array<import("../Feature.js").default>} features Features.
30988   * @param {import("./Feature.js").WriteOptions} [options] Write options.
30989   * @return {string} Encoded features.
30990   * @api
30991   */
30992  writeFeatures(t, i) {
30993    return JSON.stringify(this.writeFeaturesObject(t, i));
30994  }
30995  /**
30996   * @abstract
30997   * @param {Array<import("../Feature.js").default>} features Features.
30998   * @param {import("./Feature.js").WriteOptions} [options] Write options.
30999   * @return {Object} Object.
31000   */
31001  writeFeaturesObject(t, i) {
31002    return Z();
31003  }
31004  /**
31005   * Encode a geometry as string.
31006   *
31007   * @param {import("../geom/Geometry.js").default} geometry Geometry.
31008   * @param {import("./Feature.js").WriteOptions} [options] Write options.
31009   * @return {string} Encoded geometry.
31010   * @api
31011   */
31012  writeGeometry(t, i) {
31013    return JSON.stringify(this.writeGeometryObject(t, i));
31014  }
31015  /**
31016   * @abstract
31017   * @param {import("../geom/Geometry.js").default} geometry Geometry.
31018   * @param {import("./Feature.js").WriteOptions} [options] Write options.
31019   * @return {Object} Object.
31020   */
31021  writeGeometryObject(t, i) {
31022    return Z();
31023  }
31024}
31025function ho(e) {
31026  if (typeof e == "string") {
31027    const t = JSON.parse(e);
31028    return t || null;
31029  }
31030  return e !== null ? e : null;
31031}
31032const MT = ET;
31033class CT extends MT {
31034  /**
31035   * @param {Options} [options] Options.
31036   */
31037  constructor(t) {
31038    t = t || {}, super(), this.dataProjection = Rt(
31039      t.dataProjection ? t.dataProjection : "EPSG:4326"
31040    ), t.featureProjection && (this.defaultFeatureProjection = Rt(t.featureProjection)), this.geometryName_ = t.geometryName, this.extractGeometryName_ = t.extractGeometryName, this.supportedMediaTypes = [
31041      "application/geo+json",
31042      "application/vnd.geo+json"
31043    ];
31044  }
31045  /**
31046   * @param {Object} object Object.
31047   * @param {import("./Feature.js").ReadOptions} [options] Read options.
31048   * @protected
31049   * @return {import("../Feature.js").default} Feature.
31050   */
31051  readFeatureFromObject(t, i) {
31052    let s = null;
31053    t.type === "Feature" ? s = /** @type {GeoJSONFeature} */
31054    t : s = {
31055      type: "Feature",
31056      geometry: (
31057        /** @type {GeoJSONGeometry} */
31058        t
31059      ),
31060      properties: null
31061    };
31062    const n = Wl(s.geometry, i), r = new Di();
31063    return this.geometryName_ ? r.setGeometryName(this.geometryName_) : this.extractGeometryName_ && "geometry_name" in s !== void 0 && r.setGeometryName(s.geometry_name), r.setGeometry(n), "id" in s && r.setId(s.id), s.properties && r.setProperties(s.properties, !0), r;
31064  }
31065  /**
31066   * @param {Object} object Object.
31067   * @param {import("./Feature.js").ReadOptions} [options] Read options.
31068   * @protected
31069   * @return {Array<Feature>} Features.
31070   */
31071  readFeaturesFromObject(t, i) {
31072    const s = (
31073      /** @type {GeoJSONObject} */
31074      t
31075    );
31076    let n = null;
31077    if (s.type === "FeatureCollection") {
31078      const r = (
31079        /** @type {GeoJSONFeatureCollection} */
31080        t
31081      );
31082      n = [];
31083      const o = r.features;
31084      for (let a = 0, l = o.length; a < l; ++a)
31085        n.push(this.readFeatureFromObject(o[a], i));
31086    } else
31087      n = [this.readFeatureFromObject(t, i)];
31088    return n;
31089  }
31090  /**
31091   * @param {GeoJSONGeometry} object Object.
31092   * @param {import("./Feature.js").ReadOptions} [options] Read options.
31093   * @protected
31094   * @return {import("../geom/Geometry.js").default} Geometry.
31095   */
31096  readGeometryFromObject(t, i) {
31097    return Wl(t, i);
31098  }
31099  /**
31100   * @param {Object} object Object.
31101   * @protected
31102   * @return {import("../proj/Projection.js").default} Projection.
31103   */
31104  readProjectionFromObject(t) {
31105    const i = t.crs;
31106    let s;
31107    return i ? i.type == "name" ? s = Rt(i.properties.name) : i.type === "EPSG" ? s = Rt("EPSG:" + i.properties.code) : at(!1, 36) : s = this.dataProjection, /** @type {import("../proj/Projection.js").default} */
31108    s;
31109  }
31110  /**
31111   * Encode a feature as a GeoJSON Feature object.
31112   *
31113   * @param {import("../Feature.js").default} feature Feature.
31114   * @param {import("./Feature.js").WriteOptions} [options] Write options.
31115   * @return {GeoJSONFeature} Object.
31116   * @api
31117   */
31118  writeFeatureObject(t, i) {
31119    i = this.adaptOptions(i);
31120    const s = {
31121      type: "Feature",
31122      geometry: null,
31123      properties: null
31124    }, n = t.getId();
31125    if (n !== void 0 && (s.id = n), !t.hasProperties())
31126      return s;
31127    const r = t.getProperties(), o = t.getGeometry();
31128    return o && (s.geometry = Bl(o, i), delete r[t.getGeometryName()]), _n(r) || (s.properties = r), s;
31129  }
31130  /**
31131   * Encode an array of features as a GeoJSON object.
31132   *
31133   * @param {Array<import("../Feature.js").default>} features Features.
31134   * @param {import("./Feature.js").WriteOptions} [options] Write options.
31135   * @return {GeoJSONFeatureCollection} GeoJSON Object.
31136   * @api
31137   */
31138  writeFeaturesObject(t, i) {
31139    i = this.adaptOptions(i);
31140    const s = [];
31141    for (let n = 0, r = t.length; n < r; ++n)
31142      s.push(this.writeFeatureObject(t[n], i));
31143    return {
31144      type: "FeatureCollection",
31145      features: s
31146    };
31147  }
31148  /**
31149   * Encode a geometry as a GeoJSON object.
31150   *
31151   * @param {import("../geom/Geometry.js").default} geometry Geometry.
31152   * @param {import("./Feature.js").WriteOptions} [options] Write options.
31153   * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
31154   * @api
31155   */
31156  writeGeometryObject(t, i) {
31157    return Bl(t, this.adaptOptions(i));
31158  }
31159}
31160function Wl(e, t) {
31161  if (!e)
31162    return null;
31163  let i;
31164  switch (e.type) {
31165    case "Point": {
31166      i = wT(
31167        /** @type {GeoJSONPoint} */
31168        e
31169      );
31170      break;
31171    }
31172    case "LineString": {
31173      i = ST(
31174        /** @type {GeoJSONLineString} */
31175        e
31176      );
31177      break;
31178    }
31179    case "Polygon": {
31180      i = PT(
31181        /** @type {GeoJSONPolygon} */
31182        e
31183      );
31184      break;
31185    }
31186    case "MultiPoint": {
31187      i = RT(
31188        /** @type {GeoJSONMultiPoint} */
31189        e
31190      );
31191      break;
31192    }
31193    case "MultiLineString": {
31194      i = TT(
31195        /** @type {GeoJSONMultiLineString} */
31196        e
31197      );
31198      break;
31199    }
31200    case "MultiPolygon": {
31201      i = IT(
31202        /** @type {GeoJSONMultiPolygon} */
31203        e
31204      );
31205      break;
31206    }
31207    case "GeometryCollection": {
31208      i = bT(
31209        /** @type {GeoJSONGeometryCollection} */
31210        e
31211      );
31212      break;
31213    }
31214    default:
31215      throw new Error("Unsupported GeoJSON type: " + e.type);
31216  }
31217  return r_(i, !1, t);
31218}
31219function bT(e, t) {
31220  const i = e.geometries.map(
31221    /**
31222     * @param {GeoJSONGeometry} geometry Geometry.
31223     * @return {import("../geom/Geometry.js").default} geometry Geometry.
31224     */
31225    function(s) {
31226      return Wl(s, t);
31227    }
31228  );
31229  return new Ug(i);
31230}
31231function wT(e) {
31232  return new yi(e.coordinates);
31233}
31234function ST(e) {
31235  return new ys(e.coordinates);
31236}
31237function TT(e) {
31238  return new sc(e.coordinates);
31239}
31240function RT(e) {
31241  return new rc(e.coordinates);
31242}
31243function IT(e) {
31244  return new oc(e.coordinates);
31245}
31246function PT(e) {
31247  return new bn(e.coordinates);
31248}
31249function Bl(e, t) {
31250  e = r_(e, !0, t);
31251  const i = e.getType();
31252  let s;
31253  switch (i) {
31254    case "Point": {
31255      s = DT(
31256        /** @type {Point} */
31257        e
31258      );
31259      break;
31260    }
31261    case "LineString": {
31262      s = LT(
31263        /** @type {LineString} */
31264        e
31265      );
31266      break;
31267    }
31268    case "Polygon": {
31269      s = NT(
31270        /** @type {Polygon} */
31271        e,
31272        t
31273      );
31274      break;
31275    }
31276    case "MultiPoint": {
31277      s = FT(
31278        /** @type {MultiPoint} */
31279        e
31280      );
31281      break;
31282    }
31283    case "MultiLineString": {
31284      s = OT(
31285        /** @type {MultiLineString} */
31286        e
31287      );
31288      break;
31289    }
31290    case "MultiPolygon": {
31291      s = kT(
31292        /** @type {MultiPolygon} */
31293        e,
31294        t
31295      );
31296      break;
31297    }
31298    case "GeometryCollection": {
31299      s = AT(
31300        /** @type {GeometryCollection} */
31301        e,
31302        t
31303      );
31304      break;
31305    }
31306    case "Circle": {
31307      s = {
31308        type: "GeometryCollection",
31309        geometries: []
31310      };
31311      break;
31312    }
31313    default:
31314      throw new Error("Unsupported geometry type: " + i);
31315  }
31316  return s;
31317}
31318function AT(e, t) {
31319  return t = Object.assign({}, t), delete t.featureProjection, {
31320    type: "GeometryCollection",
31321    geometries: e.getGeometriesArray().map(function(s) {
31322      return Bl(s, t);
31323    })
31324  };
31325}
31326function LT(e, t) {
31327  return {
31328    type: "LineString",
31329    coordinates: e.getCoordinates()
31330  };
31331}
31332function OT(e, t) {
31333  return {
31334    type: "MultiLineString",
31335    coordinates: e.getCoordinates()
31336  };
31337}
31338function FT(e, t) {
31339  return {
31340    type: "MultiPoint",
31341    coordinates: e.getCoordinates()
31342  };
31343}
31344function kT(e, t) {
31345  let i;
31346  return t && (i = t.rightHanded), {
31347    type: "MultiPolygon",
31348    coordinates: e.getCoordinates(i)
31349  };
31350}
31351function DT(e, t) {
31352  return {
31353    type: "Point",
31354    coordinates: e.getCoordinates()
31355  };
31356}
31357function NT(e, t) {
31358  let i;
31359  return t && (i = t.rightHanded), {
31360    type: "Polygon",
31361    coordinates: e.getCoordinates(i)
31362  };
31363}
31364const GT = CT;
31365function o_(e) {
31366  let t = e == null ? void 0 : e.$parent;
31367  for (; t; ) {
31368    if (t.map)
31369      return t;
31370    t = t.$parent;
31371  }
31372  return null;
31373}
31374const zT = {
31375  name: "XmapWebLayerGeoJson",
31376  // Nothing to render: the layer lives on the parent's map. An explicit null
31377  // render keeps Vue from warning about a missing template.
31378  render() {
31379    return null;
31380  },
31381  // Defaults so a layer placed outside <xmap-app> (or in a test) does not warn.
31382  inject: {
31383    primaryColor: { default: null },
31384    secondaryColor: { default: null }
31385  },
31386  props: {
31387    // Fetched on mount and on change. Ignored while `data` is non-empty. A bare
31388    // WFS endpoint is completed by buildLayerUrl (see lib/geojson-layer.js).
31389    url: { type: String, default: null },
31390    // WFS typeNames when the URL is a bare endpoint whose path does not name the layer.
31391    layer: { type: String, default: null },
31392    // Inline GeoJSON text. Wins over `url`.
31393    data: { type: String, default: null },
31394    // EPSG:27700 (default) | EPSG:4326. Absent + a `crs` member → OL reads the member.
31395    projection: { type: String, default: null },
31396    // 0–100, as the WMS layer.
31397    opacity: { type: Number, default: 100 },
31398    // String, not Boolean: Vue only coerces Number attributes, so a Boolean prop
31399    // would make visible="false" truthy. Read through boolAttr().
31400    visible: { type: String, default: null },
31401    // Fit the view to the loaded extent once per load (XMP-2228 guard applies).
31402    fit: { type: String, default: null },
31403    fillColor: { type: String, default: null },
31404    strokeColor: { type: String, default: null },
31405    strokeWidth: { type: Number, default: 2 },
31406    pointRadius: { type: Number, default: 6 },
31407    // For bodies that are an array of records rather than GeoJSON: the keys
31408    // holding the point coordinates, and optionally the key (dotted path) of
31409    // the array inside a wrapping object. Each record becomes a Point.
31410    xField: { type: String, default: null },
31411    yField: { type: String, default: null },
31412    recordsField: { type: String, default: null },
31413    // Identity for checks: `layer-id` names the layer (set as the OL layer's
31414    // `id` property, so <xmap-web-check layer="…"> can find it); `asset-id` is
31415    // the feature property holding the asset reference (default `id`).
31416    layerId: { type: String, default: null },
31417    assetId: { type: String, default: null }
31418  },
31419  methods: {
31420    // Walk up to the component that owns the map rather than reading
31421    // this.$parent.map blind (shared with <xmap-web-check>, see lib/parent-map.js).
31422    resolveMapComponent() {
31423      return o_(this);
31424    },
31425    currentStyle() {
31426      return PS({
31427        fillColor: this.fillColor,
31428        strokeColor: this.strokeColor,
31429        strokeWidth: this.strokeWidth,
31430        pointRadius: this.pointRadius,
31431        primary: this.primaryColor,
31432        secondary: this.secondaryColor
31433      });
31434    },
31435    ensureLayer() {
31436      this._layer || (this._source = yn(new va()), this._layer = yn(new xa({
31437        source: this._source,
31438        // Above the WMS layers (no zIndex → 0), below the draw layer (100): the
31439        // user's own drawing is never hidden behind loaded data.
31440        zIndex: 50,
31441        style: this.currentStyle(),
31442        opacity: this.opacity / 100,
31443        visible: xs(this.visible, !0)
31444      })), this.applyIdentity());
31445    },
31446    applyIdentity() {
31447      this._layer && (this._layer.set("id", this.layerId || null), this._layer.set("assetId", this.assetId || "id"));
31448    },
31449    applyStyle() {
31450      this._layer && this._layer.setStyle(this.currentStyle());
31451    },
31452    abort() {
31453      this._controller && (this._controller.abort(), this._controller = null);
31454    },
31455    // Re-read the source. Precedence: data (trimmed, non-empty) → url → empty
31456    // layer. Both absent is not an error; it is an empty layer and emits nothing.
31457    async reload() {
31458      if (this.abort(), this._fitted = !1, !this._source)
31459        return;
31460      const e = typeof this.data == "string" ? this.data.trim() : "";
31461      if (e) {
31462        this.setFromText(e);
31463        return;
31464      }
31465      if (!this.url) {
31466        this._source.clear();
31467        return;
31468      }
31469      const t = new AbortController();
31470      this._controller = t;
31471      try {
31472        const i = await fetch(AS(this.url, { layer: this.layer, projection: this.projection }), { signal: t.signal }), s = await i.text();
31473        if (t.signal.aborted)
31474          return;
31475        if (!i.ok) {
31476          this.fail(`Layer request failed (${i.status})`);
31477          return;
31478        }
31479        this.setFromText(s);
31480      } catch (i) {
31481        if ((i == null ? void 0 : i.name) === "AbortError")
31482          return;
31483        this.fail((i == null ? void 0 : i.message) || "Network error");
31484      } finally {
31485        this._controller === t && (this._controller = null);
31486      }
31487    },
31488    setFromText(e) {
31489      if (!this._source)
31490        return;
31491      const t = TS(e, { xField: this.xField, yField: this.yField, recordsField: this.recordsField });
31492      if (!t.ok) {
31493        this.fail(t.message);
31494        return;
31495      }
31496      const i = wS(this.projection, t.object);
31497      if (i === null) {
31498        this.fail(`Unsupported projection "${this.projection}" (use EPSG:27700 or EPSG:4326)`);
31499        return;
31500      }
31501      let s;
31502      try {
31503        s = new GT().readFeatures(t.object, {
31504          ...i ? { dataProjection: i } : {},
31505          featureProjection: hc
31506        });
31507      } catch (n) {
31508        this.fail(`Invalid GeoJSON (${(n == null ? void 0 : n.message) || "unreadable geometry"})`);
31509        return;
31510      }
31511      this._source.clear(), this._source.addFeatures(s), this.emitHost("xmap-layer-loaded", { count: s.length, skipped: t.skipped }), this.maybeFit();
31512    },
31513    // Once per load, only when `fit` is on. Delegates to the map component's
31514    // fitToExtent so the XMP-2228 sized-map guard applies. maxZoom is not
31515    // optional: a single point has a zero-size extent and view.fit would
31516    // otherwise zoom to the view's maximum.
31517    maybeFit() {
31518      var t, i;
31519      if (this._fitted || !this._source || !xs(this.fit, !1))
31520        return;
31521      const e = this._source.getExtent();
31522      Is(e) || (this._fitted = !0, (i = (t = this._mapComponent) == null ? void 0 : t.fitToExtent) == null || i.call(t, e, { padding: [24, 24, 24, 24], maxZoom: 18 }));
31523    },
31524    // Every failure path: clear our own source, touch nothing else on the map.
31525    fail(e) {
31526      this._source && this._source.clear(), this.emitHost("xmap-layer-error", { message: e });
31527    },
31528    // Dispatch on the custom-element host so the event reaches the host page.
31529    // A template-less component's $el is Vue's placeholder comment inside the
31530    // shadow root; getRootNode().host on it is still the custom element.
31531    emitHost(e, t) {
31532      var s, n, r;
31533      const i = ((r = (n = (s = this.$el) == null ? void 0 : s.getRootNode) == null ? void 0 : n.call(s)) == null ? void 0 : r.host) || this.$el;
31534      i == null || i.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
31535    },
31536    // False when no parent map is reachable; otherwise the (truthy) promise of
31537    // the first load, so callers can await it.
31538    //
31539    // The first load is deferred to the next task on purpose. Custom elements
31540    // upgrade synchronously when the bundle defines them, so an inline `data`
31541    // load would emit xmap-layer-loaded before a host script placed after the
31542    // bundle has added its listener, and the event would be lost. A microtask
31543    // is not enough: the browser runs a microtask checkpoint between scripts.
31544    attach() {
31545      const e = this.resolveMapComponent();
31546      return e ? (this._mapComponent = e, this.ensureLayer(), e.map.addLayer(this._layer), new Promise((t) => setTimeout(() => t(this.reload()), 0))) : !1;
31547    }
31548  },
31549  watch: {
31550    url() {
31551      this.reload();
31552    },
31553    layer() {
31554      this.reload();
31555    },
31556    data() {
31557      this.reload();
31558    },
31559    projection() {
31560      this.reload();
31561    },
31562    xField() {
31563      this.reload();
31564    },
31565    yField() {
31566      this.reload();
31567    },
31568    recordsField() {
31569      this.reload();
31570    },
31571    opacity(e) {
31572      this._layer && this._layer.setOpacity(e / 100);
31573    },
31574    visible(e) {
31575      this._layer && this._layer.setVisible(xs(e, !0));
31576    },
31577    fit() {
31578      this._fitted = !1, this.maybeFit();
31579    },
31580    layerId() {
31581      this.applyIdentity();
31582    },
31583    assetId() {
31584      this.applyIdentity();
31585    },
31586    fillColor() {
31587      this.applyStyle();
31588    },
31589    strokeColor() {
31590      this.applyStyle();
31591    },
31592    strokeWidth() {
31593      this.applyStyle();
31594    },
31595    pointRadius() {
31596      this.applyStyle();
31597    }
31598  },
31599  mounted() {
31600    this.attach() || this.$nextTick(() => {
31601      this.attach() || this.emitHost("xmap-layer-error", { message: "<xmap-web-layer-geojson> must be a child of <xmap-web-map>" });
31602    });
31603  },
31604  beforeUnmount() {
31605    var t;
31606    this.abort();
31607    const e = (t = this._mapComponent) == null ? void 0 : t.map;
31608    e && this._layer && e.removeLayer(this._layer), this._layer = null, this._source = null, this._mapComponent = null;
31609  }
31610}, jT = {
31611  name: "XmapWebCheck",
31612  render() {
31613    return null;
31614  },
31615  props: {
31616    // Key in the aggregate results and in every event detail.
31617    name: { type: String, default: null },
31618    // The endpoint. Query string preserved; x/y appended for a Point.
31619    url: { type: String, default: null },
31620    // Shown when the rule fails (false, or required + empty). Not for transport errors.
31621    message: { type: String, default: null },
31622    // String, not Boolean: Vue only coerces Number attributes. Read through boolAttr().
31623    // `required`: an object/array result that is empty fails the check.
31624    required: { type: String, default: null },
31625    // `snap`: on a passing object result with coordinates, move the drawn point onto them.
31626    snap: { type: String, default: null },
31627    // Milliseconds before the request is abandoned and the check fails closed.
31628    timeout: { type: Number, default: qg },
31629    // banner="false": never show this check's message in the map's banner.
31630    banner: { type: String, default: null },
31631    // Sent as an x-api-key header, for Hub endpoints gated by key.
31632    apiKey: { type: String, default: null },
31633    // URL checks: the response attribute holding the asset reference. A passing
31634    // object body then records its nearest match as the selection (`asset` in
31635    // the events and the details envelope), as a layer select does. With
31636    // snap="true" the pin also moves onto it. Layer checks read asset-id from
31637    // the layer instead.
31638    assetId: { type: String, default: null },
31639    // Layer checks: the layer-id of a layer on the map, a distance ("15" metres
31640    // or "15px"), and the verdict when a feature is that close: select | fail | warn.
31641    layer: { type: String, default: null },
31642    within: { type: String, default: null },
31643    match: { type: String, default: null }
31644  },
31645  methods: {
31646    // Plain object handed to the map's runner. Read fresh on every run, so an
31647    // attribute changed after mount is picked up without any re-registration.
31648    spec() {
31649      return {
31650        name: this.name || this.url || this.layer || "check",
31651        url: this.url,
31652        message: this.message || null,
31653        required: xs(this.required, !1),
31654        snap: xs(this.snap, !1),
31655        timeout: this.timeout,
31656        banner: xs(this.banner, !0),
31657        apiKey: this.apiKey || null,
31658        assetId: this.assetId || null,
31659        layer: this.layer || null,
31660        within: this.within ?? null,
31661        match: this.match || null
31662      };
31663    },
31664    // Dispatch on the custom-element host so the event reaches the host page.
31665    emitHost(e, t) {
31666      var s, n, r;
31667      const i = ((r = (n = (s = this.$el) == null ? void 0 : s.getRootNode) == null ? void 0 : n.call(s)) == null ? void 0 : r.host) || this.$el;
31668      i == null || i.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, composed: !0 }));
31669    },
31670    // False when no parent map is reachable. Nothing to do until a geometry
31671    // exists, so unlike the layers there is no deferred first load.
31672    attach() {
31673      const e = o_(this);
31674      return !e || typeof e.registerCheck != "function" ? !1 : (this._mapComponent = e, e.registerCheck(this), !0);
31675    }
31676  },
31677  mounted() {
31678    this.attach() || this.$nextTick(() => {
31679      this.attach() || this.emitHost("xmap-check-error", { message: "<xmap-web-check> must be a child of <xmap-web-map>" });
31680    });
31681  },
31682  beforeUnmount() {
31683    var e, t;
31684    (t = (e = this._mapComponent) == null ? void 0 : e.unregisterCheck) == null || t.call(e, this), this._mapComponent = null;
31685  }
31686};
31687xe.defs("EPSG:27700", "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
31688x1(xe);
31689const WT = Rt("EPSG:27700");
31690WT.setExtent([0, 0, 7e5, 13e5]);
31691const BT = Ps(tE), UT = Ps(Iw), XT = Ps(LS), $T = Ps(eT), YT = Ps(xT), KT = Ps(zT), qT = Ps(jT), Ls = (e, t) => {
31692  customElements.get(e) || customElements.define(e, t);
31693};
31694Ls("xmap-app", BT);
31695Ls("xmap-web-map", UT);
31696Ls("xmap-web-layer-wms", XT);
31697Ls("xmap-report-form", $T);
31698Ls("xmap-address-search", YT);
31699Ls("xmap-web-layer-geojson", KT);
31700Ls("xmap-web-check", qT);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.