@maptiler/geocoding-control 3.0.0-rc.5 → 3.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- import { css as I, LitElement as M, svg as z, html as m, unsafeCSS as ce, nothing as X } from "lit";
2
- import { customElement as O, property as p, state as b, query as Ae } from "lit/decorators.js";
3
- import { convert as We } from "geo-coordinates-parser";
4
- import { classMap as D } from "lit/directives/class-map.js";
5
- import { repeat as Ve } from "lit/directives/repeat.js";
1
+ import { css as I, LitElement as F, svg as z, html as m, unsafeCSS as ne, nothing as H } from "lit";
2
+ import { customElement as O, property as p, state as b, query as De } from "lit/decorators.js";
3
+ import { convert as Ve } from "geo-coordinates-parser";
4
+ import { classMap as W } from "lit/directives/class-map.js";
5
+ import { repeat as qe } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
- import { styleMap as qe } from "lit/directives/style-map.js";
8
- import { featureCollection as q, polygon as Ne, feature as Ze } from "@turf/helpers";
7
+ import { styleMap as Ne } from "lit/directives/style-map.js";
8
+ import { featureCollection as D, polygon as Ze, feature as Qe } from "@turf/helpers";
9
9
  import Le from "@turf/union";
10
- import he from "maplibre-gl";
10
+ import ce from "maplibre-gl";
11
11
  import be from "@turf/bbox";
12
- import Qe from "@turf/difference";
13
- import Ke from "@turf/flatten";
14
- var Ye = Object.getOwnPropertyDescriptor, He = (t, e, i, o) => {
15
- for (var r = o > 1 ? void 0 : o ? Ye(e, i) : e, s = t.length - 1, a; s >= 0; s--)
16
- (a = t[s]) && (r = a(r) || r);
17
- return r;
12
+ import Ke from "@turf/difference";
13
+ import Ye from "@turf/flatten";
14
+ var He = Object.getOwnPropertyDescriptor, Je = (t, e, i, a) => {
15
+ for (var s = a > 1 ? void 0 : a ? He(e, i) : e, o = t.length - 1, r; o >= 0; o--)
16
+ (r = t[o]) && (s = r(s) || s);
17
+ return s;
18
18
  };
19
- let ee = class extends M {
19
+ let J = class extends F {
20
20
  render() {
21
21
  return z`
22
22
  <svg viewBox="0 0 14 14" width="13" height="13">
@@ -27,21 +27,21 @@ let ee = class extends M {
27
27
  `;
28
28
  }
29
29
  };
30
- ee.styles = I`
30
+ J.styles = I`
31
31
  svg {
32
32
  display: block;
33
33
  fill: var(--color-icon-button);
34
34
  }
35
35
  `;
36
- ee = He([
36
+ J = Je([
37
37
  O("maptiler-geocode-clear-icon")
38
- ], ee);
39
- var Je = Object.getOwnPropertyDescriptor, Xe = (t, e, i, o) => {
40
- for (var r = o > 1 ? void 0 : o ? Je(e, i) : e, s = t.length - 1, a; s >= 0; s--)
41
- (a = t[s]) && (r = a(r) || r);
42
- return r;
38
+ ], J);
39
+ var Xe = Object.getOwnPropertyDescriptor, et = (t, e, i, a) => {
40
+ for (var s = a > 1 ? void 0 : a ? Xe(e, i) : e, o = t.length - 1, r; o >= 0; o--)
41
+ (r = t[o]) && (s = r(s) || s);
42
+ return s;
43
43
  };
44
- let te = class extends M {
44
+ let X = class extends F {
45
45
  render() {
46
46
  return z`
47
47
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -52,21 +52,21 @@ let te = class extends M {
52
52
  `;
53
53
  }
54
54
  };
55
- te.styles = I`
55
+ X.styles = I`
56
56
  svg {
57
57
  display: block;
58
58
  fill: #e15042;
59
59
  }
60
60
  `;
61
- te = Xe([
61
+ X = et([
62
62
  O("maptiler-geocode-fail-icon")
63
- ], te);
64
- var et = Object.getOwnPropertyDescriptor, tt = (t, e, i, o) => {
65
- for (var r = o > 1 ? void 0 : o ? et(e, i) : e, s = t.length - 1, a; s >= 0; s--)
66
- (a = t[s]) && (r = a(r) || r);
67
- return r;
63
+ ], X);
64
+ var tt = Object.getOwnPropertyDescriptor, it = (t, e, i, a) => {
65
+ for (var s = a > 1 ? void 0 : a ? tt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
66
+ (r = t[o]) && (s = r(s) || s);
67
+ return s;
68
68
  };
69
- let ie = class extends M {
69
+ let ee = class extends F {
70
70
  render() {
71
71
  return m`
72
72
  <div>
@@ -78,7 +78,7 @@ let ie = class extends M {
78
78
  `;
79
79
  }
80
80
  };
81
- ie.styles = I`
81
+ ee.styles = I`
82
82
  div {
83
83
  position: absolute;
84
84
  left: 50%;
@@ -105,15 +105,15 @@ ie.styles = I`
105
105
  }
106
106
  }
107
107
  `;
108
- ie = tt([
108
+ ee = it([
109
109
  O("maptiler-geocode-loading-icon")
110
- ], ie);
111
- var it = Object.getOwnPropertyDescriptor, st = (t, e, i, o) => {
112
- for (var r = o > 1 ? void 0 : o ? it(e, i) : e, s = t.length - 1, a; s >= 0; s--)
113
- (a = t[s]) && (r = a(r) || r);
114
- return r;
110
+ ], ee);
111
+ var st = Object.getOwnPropertyDescriptor, rt = (t, e, i, a) => {
112
+ for (var s = a > 1 ? void 0 : a ? st(e, i) : e, o = t.length - 1, r; o >= 0; o--)
113
+ (r = t[o]) && (s = r(s) || s);
114
+ return s;
115
115
  };
116
- let se = class extends M {
116
+ let te = class extends F {
117
117
  render() {
118
118
  return z`
119
119
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
@@ -124,21 +124,21 @@ let se = class extends M {
124
124
  `;
125
125
  }
126
126
  };
127
- se.styles = I`
127
+ te.styles = I`
128
128
  svg {
129
129
  display: block;
130
130
  fill: var(--color-icon-button);
131
131
  }
132
132
  `;
133
- se = st([
133
+ te = rt([
134
134
  O("maptiler-geocode-reverse-geocoding-icon")
135
- ], se);
136
- var rt = Object.getOwnPropertyDescriptor, ot = (t, e, i, o) => {
137
- for (var r = o > 1 ? void 0 : o ? rt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
138
- (a = t[s]) && (r = a(r) || r);
139
- return r;
135
+ ], te);
136
+ var ot = Object.getOwnPropertyDescriptor, at = (t, e, i, a) => {
137
+ for (var s = a > 1 ? void 0 : a ? ot(e, i) : e, o = t.length - 1, r; o >= 0; o--)
138
+ (r = t[o]) && (s = r(s) || s);
139
+ return s;
140
140
  };
141
- let re = class extends M {
141
+ let ie = class extends F {
142
142
  render() {
143
143
  return z`
144
144
  <svg
@@ -153,7 +153,7 @@ let re = class extends M {
153
153
  `;
154
154
  }
155
155
  };
156
- re.styles = I`
156
+ ie.styles = I`
157
157
  circle {
158
158
  stroke-width: 1.875;
159
159
  fill: none;
@@ -169,74 +169,74 @@ re.styles = I`
169
169
  stroke: var(--color-icon-button);
170
170
  }
171
171
  `;
172
- re = ot([
172
+ ie = at([
173
173
  O("maptiler-geocode-search-icon")
174
- ], re);
175
- function at(t, e, i) {
176
- const o = e[1], r = e[0], s = o - r;
177
- return t === o && i ? t : ((t - r) % s + s) % s + r;
174
+ ], ie);
175
+ function lt(t, e, i) {
176
+ const a = e[1], s = e[0], o = a - s;
177
+ return t === a && i ? t : ((t - s) % o + o) % o + s;
178
178
  }
179
- function N(t) {
179
+ function V(t) {
180
180
  const e = [...t];
181
181
  return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
182
182
  }
183
- let U;
184
- async function lt(t, e, i) {
185
- for (const o of e ?? [])
186
- if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
187
- if (o.type === "fixed")
188
- return o.coordinates.join(",");
189
- if (o.type === "client-geolocation")
190
- if (U && o.cachedLocationExpiry && U.time + o.cachedLocationExpiry > Date.now()) {
191
- if (U.coords)
192
- return U.coords;
183
+ let P;
184
+ async function nt(t, e, i) {
185
+ for (const a of e ?? [])
186
+ if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
187
+ if (a.type === "fixed")
188
+ return a.coordinates.join(",");
189
+ if (a.type === "client-geolocation")
190
+ if (P && a.cachedLocationExpiry && P.time + a.cachedLocationExpiry > Date.now()) {
191
+ if (P.coords)
192
+ return P.coords;
193
193
  } else {
194
- let r;
194
+ let s;
195
195
  try {
196
- return r = await new Promise((s, a) => {
196
+ return s = await new Promise((o, r) => {
197
197
  i.signal.addEventListener("abort", () => {
198
- a(Error("aborted"));
198
+ r(Error("aborted"));
199
199
  }), navigator.geolocation.getCurrentPosition(
200
- (f) => {
201
- s([f.coords.longitude, f.coords.latitude].map((L) => L.toFixed(6)).join(","));
200
+ (u) => {
201
+ o([u.coords.longitude, u.coords.latitude].map((y) => y.toFixed(6)).join(","));
202
202
  },
203
- (f) => {
204
- a(f);
203
+ (u) => {
204
+ r(u);
205
205
  },
206
- o
206
+ a
207
207
  );
208
- }), r;
208
+ }), s;
209
209
  } catch {
210
210
  } finally {
211
- o.cachedLocationExpiry && (U = {
211
+ a.cachedLocationExpiry && (P = {
212
212
  time: Date.now(),
213
- coords: r
213
+ coords: s
214
214
  });
215
215
  }
216
216
  if (i.signal.aborted)
217
217
  return;
218
218
  }
219
- if (o.type === "server-geolocation")
219
+ if (a.type === "server-geolocation")
220
220
  return "ip";
221
- if (t && o.type === "map-center")
221
+ if (t && a.type === "map-center")
222
222
  return t[1].toFixed(6) + "," + t[2].toFixed(6);
223
223
  }
224
224
  }
225
- const nt = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
226
- var ct = Object.defineProperty, ht = Object.getOwnPropertyDescriptor, $e = (t) => {
225
+ const ct = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
226
+ var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, $e = (t) => {
227
227
  throw TypeError(t);
228
- }, _ = (t, e, i, o) => {
229
- for (var r = o > 1 ? void 0 : o ? ht(e, i) : e, s = t.length - 1, a; s >= 0; s--)
230
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
231
- return o && r && ct(e, i, r), r;
232
- }, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), u = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), pt = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Ie(t, e, "access private method"), i), d, Z, B, g, Me, Oe, pe, oe;
233
- const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Se = Te ? "@2x" : "", F = Te ? 2 : 1;
234
- let T, Fe, k = class extends M {
228
+ }, L = (t, e, i, a) => {
229
+ for (var s = a > 1 ? void 0 : a ? pt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
230
+ (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
231
+ return a && s && ht(e, i, s), s;
232
+ }, Ie = (t, e, i) => e.has(t) || $e("Cannot " + i), f = (t, e, i) => (Ie(t, e, "read from private field"), i ? i.call(t) : e.get(t)), dt = (t, e, i) => e.has(t) ? $e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), C = (t, e, i) => (Ie(t, e, "access private method"), i), d, q, B, g, Fe, Oe, he, se;
233
+ const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Me = Te ? "@2x" : "", S = Te ? 2 : 1;
234
+ let M, Se, w = class extends F {
235
235
  constructor() {
236
- super(...arguments), pt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
236
+ super(...arguments), dt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
237
237
  }
238
238
  willUpdate(t) {
239
- t.has("feature") && u(this, d, Z) && (this.index = u(this, d, Z).length, E(this, d, pe).call(this));
239
+ t.has("feature") && f(this, d, q) && (this.index = f(this, d, q).length, C(this, d, he).call(this));
240
240
  }
241
241
  render() {
242
242
  return m`
@@ -248,35 +248,35 @@ let T, Fe, k = class extends M {
248
248
  class=${this.itemStyle}
249
249
  @click=${() => this.dispatchEvent(new CustomEvent("select"))}
250
250
  >
251
- ${T && this.spriteIcon ? m`
251
+ ${M && this.spriteIcon ? m`
252
252
  <div
253
253
  class="sprite-icon"
254
- style=${qe({
255
- width: `${this.spriteIcon.width / F}px`,
256
- height: `${this.spriteIcon.height / F}px`,
257
- backgroundImage: `url(${this.iconsBaseUrl}sprite${Se}.png)`,
258
- backgroundPosition: `-${this.spriteIcon.x / F}px -${this.spriteIcon.y / F}px`,
259
- backgroundSize: `${T.width / F}px ${T.height / F}px`
254
+ style=${Ne({
255
+ width: `${this.spriteIcon.width / S}px`,
256
+ height: `${this.spriteIcon.height / S}px`,
257
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${Me}.png)`,
258
+ backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
259
+ backgroundSize: `${M.width / S}px ${M.height / S}px`
260
260
  })}
261
- title=${u(this, d, g)}
261
+ title=${f(this, d, g)}
262
262
  />
263
- ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${E(this, d, Oe)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d, B) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> `}
263
+ ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${C(this, d, Oe)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : f(this, d, B) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> `}
264
264
 
265
265
  <span class="texts">
266
266
  <span>
267
- <span class="primary"> ${u(this, d, B) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
267
+ <span class="primary"> ${f(this, d, B) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
268
268
 
269
- ${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !u(this, d, B) ? m` <span class="secondary"> ${u(this, d, g)} </span> ` : X}
269
+ ${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, d, B) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : H}
270
270
  </span>
271
271
 
272
- <span class="line2"> ${u(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
272
+ <span class="line2"> ${f(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
273
273
  </span>
274
274
  </li>
275
275
  `;
276
276
  }
277
277
  };
278
278
  d = /* @__PURE__ */ new WeakSet();
279
- Z = function() {
279
+ q = function() {
280
280
  return this.feature?.properties?.categories;
281
281
  };
282
282
  B = function() {
@@ -285,75 +285,75 @@ B = function() {
285
285
  g = function() {
286
286
  return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
287
287
  };
288
- Me = function() {
289
- Fe ??= fetch(`${this.iconsBaseUrl}sprite${Se}.json`).then((t) => t.json()).then((t) => {
290
- T = t;
288
+ Fe = function() {
289
+ Se ??= fetch(`${this.iconsBaseUrl}sprite${Me}.json`).then((t) => t.json()).then((t) => {
290
+ M = t;
291
291
  }).catch(() => {
292
- T = null;
292
+ M = null;
293
293
  });
294
294
  };
295
295
  Oe = function() {
296
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, d, pe).call(this);
296
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, he).call(this);
297
297
  };
298
- pe = function() {
299
- T !== void 0 ? E(this, d, oe).call(this) : (E(this, d, Me).call(this), Fe?.then(() => {
300
- E(this, d, oe).call(this);
298
+ he = function() {
299
+ M !== void 0 ? C(this, d, se).call(this) : (C(this, d, Fe).call(this), Se?.then(() => {
300
+ C(this, d, se).call(this);
301
301
  }));
302
302
  };
303
- oe = function() {
303
+ se = function() {
304
304
  do {
305
- if (this.index--, this.category = u(this, d, Z)?.[this.index], this.spriteIcon = this.category ? T?.icons[this.category] : void 0, this.spriteIcon)
305
+ if (this.index--, this.category = f(this, d, q)?.[this.index], this.spriteIcon = this.category ? M?.icons[this.category] : void 0, this.spriteIcon)
306
306
  break;
307
307
  this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
308
308
  } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
309
309
  };
310
- k.styles = I`
311
- ${ce(nt)}
310
+ w.styles = I`
311
+ ${ne(ct)}
312
312
  `;
313
- _([
313
+ L([
314
314
  p({ type: Object })
315
- ], k.prototype, "feature", 2);
316
- _([
315
+ ], w.prototype, "feature", 2);
316
+ L([
317
317
  p({ type: String })
318
- ], k.prototype, "itemStyle", 2);
319
- _([
318
+ ], w.prototype, "itemStyle", 2);
319
+ L([
320
320
  p({ type: String })
321
- ], k.prototype, "showPlaceType", 2);
322
- _([
321
+ ], w.prototype, "showPlaceType", 2);
322
+ L([
323
323
  p({ attribute: !1 })
324
- ], k.prototype, "missingIconsCache", 2);
325
- _([
324
+ ], w.prototype, "missingIconsCache", 2);
325
+ L([
326
326
  p({ type: String })
327
- ], k.prototype, "iconsBaseUrl", 2);
328
- _([
327
+ ], w.prototype, "iconsBaseUrl", 2);
328
+ L([
329
329
  b()
330
- ], k.prototype, "category", 2);
331
- _([
330
+ ], w.prototype, "category", 2);
331
+ L([
332
332
  b()
333
- ], k.prototype, "imageUrl", 2);
334
- _([
333
+ ], w.prototype, "imageUrl", 2);
334
+ L([
335
335
  b()
336
- ], k.prototype, "spriteIcon", 2);
337
- _([
336
+ ], w.prototype, "spriteIcon", 2);
337
+ L([
338
338
  b()
339
- ], k.prototype, "index", 2);
340
- k = _([
339
+ ], w.prototype, "index", 2);
340
+ w = L([
341
341
  O("maptiler-geocoder-feature-item")
342
- ], k);
343
- const dt = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
344
- var ut = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, Ce = (t) => {
342
+ ], w);
343
+ const ut = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
344
+ var ft = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, Ce = (t) => {
345
345
  throw TypeError(t);
346
- }, c = (t, e, i, o) => {
347
- for (var r = o > 1 ? void 0 : o ? ft(e, i) : e, s = t.length - 1, a; s >= 0; s--)
348
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
349
- return o && r && ut(e, i, r), r;
350
- }, de = (t, e, i) => e.has(t) || Ce("Cannot " + i), x = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), C = (t, e, i) => e.has(t) ? Ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, o) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), Q, V, G, ae, R, l, K, Ee, Pe, ue, v, fe, Y, me, ge, $, ye, H, Ue, le, Be, Ge, Re, ze, je;
351
- let n = class extends M {
346
+ }, c = (t, e, i, a) => {
347
+ for (var s = a > 1 ? void 0 : a ? mt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
348
+ (r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
349
+ return a && s && ft(e, i, s), s;
350
+ }, pe = (t, e, i) => e.has(t) || Ce("Cannot " + i), k = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), U = (t, e, i) => e.has(t) ? Ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), re = (t, e, i, a) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), N, G, oe, R, l, Z, Ee, de, x, ue, Q, fe, me, $, ge, K, Pe, ae, Ue, Be, Ge, Re, ze, je, We;
351
+ let n = class extends F {
352
352
  constructor() {
353
- super(...arguments), C(this, l), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.focusedDelayed = !1, C(this, Q, !1), C(this, V, !1), C(this, G), C(this, ae, /* @__PURE__ */ new Set()), C(this, R);
353
+ super(...arguments), U(this, l), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, U(this, N, !1), U(this, G), U(this, oe, /* @__PURE__ */ new Set()), U(this, R);
354
354
  }
355
355
  firstUpdated() {
356
- W(this, Q, !0);
356
+ re(this, N, !0);
357
357
  }
358
358
  /**
359
359
  * Set the options of this instance.
@@ -363,7 +363,7 @@ let n = class extends M {
363
363
  setOptions(t) {
364
364
  const e = { ...t };
365
365
  for (const i of Object.keys(e))
366
- mt.includes(i) || delete e[i];
366
+ gt.includes(i) || delete e[i];
367
367
  Object.assign(this, e);
368
368
  }
369
369
  /**
@@ -372,7 +372,7 @@ let n = class extends M {
372
372
  * @param value text to set
373
373
  */
374
374
  setQuery(t) {
375
- h(this, l, ge).call(this, t), h(this, l, me).call(this);
375
+ h(this, l, me).call(this, t, { external: !0 }), h(this, l, fe).call(this);
376
376
  }
377
377
  /**
378
378
  * Set the content of search input box and immediately submit it.
@@ -380,7 +380,7 @@ let n = class extends M {
380
380
  * @param value text to set and submit
381
381
  */
382
382
  submitQuery(t) {
383
- h(this, l, ye).call(this, t);
383
+ h(this, l, ge).call(this, t);
384
384
  }
385
385
  /**
386
386
  * Clear search result list.
@@ -410,27 +410,25 @@ let n = class extends M {
410
410
  }
411
411
  /** @internal */
412
412
  handleMapChange(t) {
413
- W(this, R, t);
413
+ re(this, R, t);
414
414
  }
415
415
  /** @internal */
416
416
  handleMapClick(t) {
417
- this.reverseActive && h(this, l, Ue).call(this, t);
417
+ this.reverseActive && h(this, l, Pe).call(this, t);
418
418
  }
419
419
  willUpdate(t) {
420
- t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && x(this, l, ue) && (h(this, l, $).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
421
- this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
422
- }, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, l, v).call(this, "select", { feature: x(this, l, K) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, l, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
420
+ t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && k(this, l, de) && (h(this, l, $).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, l, x).call(this, "select", { feature: k(this, l, Z) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, l, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
423
421
  () => {
424
- h(this, l, v).call(this, "pick", { feature: this.picked });
422
+ h(this, l, x).call(this, "pick", { feature: this.picked });
425
423
  },
426
424
  (e) => {
427
- e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, v).call(this, "pick", { feature: this.picked }));
425
+ e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, l, x).call(this, "pick", { feature: this.picked }));
428
426
  }
429
- ), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (x(this, l, Ee) ? (h(this, l, v).call(this, "featuresshow"), W(this, V, !0)) : x(this, V) && h(this, l, v).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, v).call(this, "reversetoggle", { reverse: this.reverseActive });
427
+ ), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? h(this, l, x).call(this, "featuresshow") : h(this, l, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, l, x).call(this, "reversetoggle", { reverse: this.reverseActive });
430
428
  }
431
429
  render() {
432
430
  return m`
433
- <form @submit=${h(this, l, fe)} class=${D({ "can-collapse": this.collapsed && this.searchValue === "" })}>
431
+ <form @submit=${h(this, l, ue)} class=${W({ "can-collapse": this.collapsed && this.searchValue === "" })}>
434
432
  <div class="input-group">
435
433
  <button
436
434
  class="search-button"
@@ -447,16 +445,16 @@ let n = class extends M {
447
445
  @focus=${() => this.focused = !0}
448
446
  @blur=${() => this.focused = !1}
449
447
  @click=${() => this.focused = !0}
450
- @keydown=${h(this, l, le)}
451
- @input=${h(this, l, Be)}
448
+ @keydown=${h(this, l, ae)}
449
+ @input=${h(this, l, Ue)}
452
450
  @change=${() => this.picked = void 0}
453
451
  placeholder=${this.placeholder ?? "Search"}
454
452
  aria-label=${this.placeholder ?? "Search"}
455
453
  />
456
454
 
457
- <div class="clear-button-container ${D({ displayable: this.searchValue !== "" })}">
458
- ${x(this, l, Pe) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
459
- <button type="button" @click=${h(this, l, je)} title=${this.clearButtonTitle ?? "clear"}>
455
+ <div class="clear-button-container ${W({ displayable: this.searchValue !== "" })}">
456
+ ${k(this, l, Ee) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
457
+ <button type="button" @click=${h(this, l, We)} title=${this.clearButtonTitle ?? "clear"}>
460
458
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
461
459
  </button>
462
460
  `}
@@ -465,13 +463,13 @@ let n = class extends M {
465
463
  ${this.enableReverse === "button" ? m`
466
464
  <button
467
465
  type="button"
468
- class=${D({ active: this.reverseActive })}
466
+ class=${W({ active: this.reverseActive })}
469
467
  title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}
470
468
  @click=${() => this.reverseActive = !this.reverseActive}
471
469
  >
472
470
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
473
471
  </button>
474
- ` : X}
472
+ ` : H}
475
473
 
476
474
  <!-- <slot /> -->
477
475
  </div>
@@ -486,7 +484,7 @@ let n = class extends M {
486
484
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
487
485
  </button>
488
486
  </div>
489
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? X : this.listFeatures.length === 0 ? m`
487
+ ` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? m`
490
488
  <div class="no-results">
491
489
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
492
490
 
@@ -495,8 +493,15 @@ let n = class extends M {
495
493
  </div>
496
494
  </div>
497
495
  ` : m`
498
- <ul class="options ${D({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, l, ze)} @keydown=${h(this, l, le)} role="listbox">
499
- ${Ve(
496
+ <ul
497
+ class="options ${W({ "open-on-top": this.openListOnTop })}"
498
+ @pointerleave=${h(this, l, Re)}
499
+ @pointerdown=${h(this, l, ze)}
500
+ @pointerup=${h(this, l, je)}
501
+ @keydown=${h(this, l, ae)}
502
+ role="listbox"
503
+ >
504
+ ${qe(
500
505
  this.listFeatures,
501
506
  (t) => t.id + (t.address ? "," + t.address : ""),
502
507
  (t, e) => m`
@@ -504,17 +509,15 @@ let n = class extends M {
504
509
  .feature=${t}
505
510
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
506
511
  itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
507
- @mouseenter=${() => {
508
- h(this, l, Re).call(this, e);
512
+ @pointerenter=${() => {
513
+ h(this, l, Ge).call(this, e);
509
514
  }}
510
515
  @select=${() => {
511
- h(this, l, Ge).call(this, t);
516
+ h(this, l, Be).call(this, t);
512
517
  }}
513
- .missingIconsCache=${x(this, ae)}
514
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/"}
515
- >
516
- ${t.place_name}
517
- </maptiler-geocoder-feature-item>
518
+ .missingIconsCache=${k(this, oe)}
519
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
520
+ />
518
521
  `
519
522
  )}
520
523
  </ul>
@@ -523,26 +526,22 @@ let n = class extends M {
523
526
  `;
524
527
  }
525
528
  };
526
- Q = /* @__PURE__ */ new WeakMap();
527
- V = /* @__PURE__ */ new WeakMap();
529
+ N = /* @__PURE__ */ new WeakMap();
528
530
  G = /* @__PURE__ */ new WeakMap();
529
- ae = /* @__PURE__ */ new WeakMap();
531
+ oe = /* @__PURE__ */ new WeakMap();
530
532
  R = /* @__PURE__ */ new WeakMap();
531
533
  l = /* @__PURE__ */ new WeakSet();
532
- K = function() {
534
+ Z = function() {
533
535
  return this.listFeatures?.[this.selectedItemIndex];
534
536
  };
535
537
  Ee = function() {
536
- return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
537
- };
538
- Pe = function() {
539
538
  return this.abortController !== void 0;
540
539
  };
541
- ue = function() {
540
+ de = function() {
542
541
  return this.searchValue.length < (this.minLength ?? 2);
543
542
  };
544
- v = function(t, ...[e]) {
545
- x(this, Q) && this.dispatchEvent(
543
+ x = function(t, ...[e]) {
544
+ k(this, N) && this.dispatchEvent(
546
545
  new CustomEvent(t, {
547
546
  bubbles: !0,
548
547
  composed: !0,
@@ -550,128 +549,136 @@ v = function(t, ...[e]) {
550
549
  })
551
550
  );
552
551
  };
553
- fe = function(t) {
554
- t?.preventDefault(), this.focused = !1, clearTimeout(x(this, G)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, l, H).call(this, this.searchValue, { exact: !0 }).then(() => {
552
+ ue = function(t) {
553
+ t?.preventDefault(), this.focused = !1, clearTimeout(k(this, G)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, l, K).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
555
554
  this.picked = void 0;
556
555
  }).catch((e) => this.error = e);
557
556
  };
558
- Y = function(t) {
557
+ Q = function(t) {
559
558
  try {
560
- return We(t, 6);
559
+ return Ve(t, 6);
561
560
  } catch {
562
561
  return !1;
563
562
  }
564
563
  };
565
- me = function() {
564
+ fe = function() {
566
565
  setTimeout(() => {
567
566
  this.input.focus(), this.focused = !0, this.input.select();
568
567
  });
569
568
  };
570
- ge = function(t) {
571
- if (this.searchValue = t, h(this, l, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
572
- if (clearTimeout(x(this, G)), x(this, l, ue))
569
+ me = function(t, { external: e = !1 } = {}) {
570
+ if (this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Q).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
571
+ if (clearTimeout(k(this, G)), k(this, l, de))
573
572
  return;
574
- const e = this.searchValue;
575
- W(this, G, window.setTimeout(() => {
576
- h(this, l, H).call(this, e).catch((i) => this.error = i);
573
+ const i = this.searchValue;
574
+ re(this, G, window.setTimeout(() => {
575
+ h(this, l, K).call(this, i, { external: e }).catch((a) => this.error = a);
577
576
  }, this.debounceSearch ?? 200));
578
577
  } else
579
578
  h(this, l, $).call(this);
580
579
  };
581
580
  $ = function() {
582
- this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, v).call(this, "featuresclear"));
581
+ this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, l, x).call(this, "featuresclear"));
583
582
  };
584
- ye = function(t) {
585
- this.searchValue = t, h(this, l, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, l, fe).call(this);
583
+ ge = function(t) {
584
+ this.searchValue = t, h(this, l, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, l, Q).call(this, t) }), this.selectedItemIndex = -1, h(this, l, ue).call(this);
586
585
  };
587
- H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
586
+ K = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
588
587
  this.error = void 0, this.abortController?.abort();
589
- const o = new AbortController();
590
- this.abortController = o;
588
+ const s = new AbortController();
589
+ this.abortController = s;
591
590
  try {
592
- const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", s = h(this, l, Y).call(this, t), a = new URL(r + "/" + encodeURIComponent(s ? `${s.decimalLongitude},${s.decimalLatitude}` : t) + ".json"), f = a.searchParams;
593
- this.language !== void 0 && f.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
594
- const [L] = x(this, R) ?? [void 0];
595
- let w = (!s || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
596
- (y) => typeof y == "string" ? y : L === void 0 || (y[0] ?? 0) <= L && L < (y[1] ?? 1 / 0) ? y[2] : void 0
597
- ).filter((y) => y !== void 0);
598
- w && (w = [...new Set(w)], f.set("types", w.join(",")));
599
- const S = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
600
- if (S && f.set("excludeTypes", String(S)), this.bbox && f.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && f.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && f.set("worldview", this.worldview), !e && !s) {
601
- const y = this.proximity ?? [{ type: "server-geolocation" }], xe = await lt(x(this, R), y, o);
602
- xe && f.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && f.set("autocomplete", "false"), f.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
591
+ const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, l, Q).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
592
+ this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
593
+ const [T] = k(this, R) ?? [void 0];
594
+ let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
595
+ (v) => typeof v == "string" ? v : T === void 0 || (v[0] ?? 0) <= T && T < (v[1] ?? 1 / 0) ? v[2] : void 0
596
+ ).filter((v) => v !== void 0);
597
+ _ && (_ = [...new Set(_)], y.set("types", _.join(",")));
598
+ const ye = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
599
+ if (ye && y.set("excludeTypes", String(ye)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !r) {
600
+ const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await nt(k(this, R), v, s);
601
+ xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
603
602
  }
604
- const ve = this.limit ?? 5, J = this.reverseGeocodingLimit ?? ve;
605
- J > 1 && w?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), s ? (J === 1 || this.exhaustiveReverseGeocoding || w?.length === 1) && f.set("limit", String(J)) : f.set("limit", String(ve)), this.apiKey && f.set("key", this.apiKey), this.adjustUrl?.(a);
606
- const De = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", j = a.toString();
603
+ const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
604
+ Y > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (Y === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
605
+ const Ae = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
607
606
  if (j === this.lastSearchUrl) {
608
- e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, K)?.id && (this.selectedItemIndex = -1));
607
+ e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, Z)?.id && (this.selectedItemIndex = -1));
609
608
  return;
610
609
  }
611
- h(this, l, v).call(this, "request", { urlObj: a }), this.lastSearchUrl = j;
612
- let P;
613
- if (De)
614
- P = { type: "FeatureCollection", features: [] };
610
+ h(this, l, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
611
+ let E;
612
+ if (Ae)
613
+ E = { type: "FeatureCollection", features: [] };
615
614
  else {
616
- const y = await fetch(j, {
617
- signal: o.signal,
615
+ const v = await fetch(j, {
616
+ signal: s.signal,
618
617
  ...this.fetchParameters
619
618
  });
620
- if (!y.ok)
621
- throw new Error(await y.text());
622
- P = await y.json();
619
+ if (!v.ok)
620
+ throw new Error(await v.text());
621
+ E = await v.json();
623
622
  }
624
- h(this, l, v).call(this, "response", { url: j, featureCollection: P }), e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), s && this.listFeatures.unshift({
623
+ h(this, l, x).call(this, "response", { url: j, featureCollection: E }), e ? (this.clearListOnPick && h(this, l, $).call(this), this.picked = E.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = E.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
625
624
  type: "Feature",
626
625
  properties: {},
627
626
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
628
- id: `reverse_${s.decimalLongitude}_${s.decimalLatitude}`,
629
- text: `${s.decimalLatitude}, ${s.decimalLongitude}`,
630
- place_name: s.toCoordinateFormat("DMS"),
627
+ id: `reverse_${r.decimalLongitude}_${r.decimalLatitude}`,
628
+ text: `${r.decimalLatitude}, ${r.decimalLongitude}`,
629
+ place_name: r.toCoordinateFormat("DMS"),
631
630
  /* eslint-enable @typescript-eslint/restrict-template-expressions */
632
631
  place_type: ["reverse"],
633
632
  place_type_name: ["reverse"],
634
- center: [s.decimalLongitude, s.decimalLatitude],
635
- bbox: [s.decimalLongitude, s.decimalLatitude, s.decimalLongitude, s.decimalLatitude],
633
+ center: [r.decimalLongitude, r.decimalLatitude],
634
+ bbox: [r.decimalLongitude, r.decimalLatitude, r.decimalLongitude, r.decimalLatitude],
636
635
  geometry: {
637
636
  type: "Point",
638
- coordinates: [s.decimalLongitude, s.decimalLatitude]
637
+ coordinates: [r.decimalLongitude, r.decimalLatitude]
639
638
  }
640
- }), h(this, l, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, l, K)?.id && (this.selectedItemIndex = -1), s && this.input.focus());
641
- } catch (r) {
642
- if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
639
+ }), h(this, l, x).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, Z)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
640
+ } catch (o) {
641
+ if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
643
642
  return;
644
- throw r;
643
+ throw o;
645
644
  } finally {
646
- o === this.abortController && (this.abortController = void 0);
645
+ s === this.abortController && (this.abortController = void 0);
647
646
  }
648
647
  };
649
- Ue = function(t) {
650
- this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ye).call(this, `${t[1].toFixed(6)}, ${at(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, me).call(this);
648
+ Pe = function(t) {
649
+ this.reverseActive = this.enableReverse === "always", h(this, l, $).call(this), this.picked = void 0, h(this, l, ge).call(this, `${t[1].toFixed(6)}, ${lt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, l, fe).call(this);
651
650
  };
652
- le = function(t) {
651
+ ae = function(t) {
653
652
  if (!this.listFeatures)
654
653
  return;
655
654
  const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
656
655
  e && (this.input.focus(), this.focused = !0, t.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
657
656
  };
658
- Be = function(t) {
659
- h(this, l, ge).call(this, t.target.value);
657
+ Ue = function(t) {
658
+ h(this, l, me).call(this, t.target.value);
660
659
  };
661
- Ge = function(t) {
660
+ Be = function(t) {
662
661
  (!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
663
662
  };
664
- Re = function(t) {
663
+ Ge = function(t) {
665
664
  this.selectedItemIndex = t;
666
665
  };
666
+ Re = function() {
667
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
668
+ };
667
669
  ze = function() {
668
- (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
670
+ this.isFeatureListInteractedWith = !0;
669
671
  };
670
672
  je = function() {
671
- this.searchValue = "", h(this, l, v).call(this, "queryclear"), this.picked = void 0, this.input.focus();
673
+ setTimeout(() => {
674
+ this.isFeatureListInteractedWith = !1;
675
+ });
676
+ };
677
+ We = function() {
678
+ this.searchValue = "", h(this, l, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
672
679
  };
673
680
  n.styles = I`
674
- ${ce(dt)}
681
+ ${ne(ut)}
675
682
  `;
676
683
  c([
677
684
  p({ attribute: !1 })
@@ -785,7 +792,7 @@ c([
785
792
  p({ type: String })
786
793
  ], n.prototype, "worldview", 2);
787
794
  c([
788
- Ae("input")
795
+ De("input")
789
796
  ], n.prototype, "input", 2);
790
797
  c([
791
798
  b()
@@ -816,11 +823,14 @@ c([
816
823
  ], n.prototype, "focused", 2);
817
824
  c([
818
825
  b()
819
- ], n.prototype, "focusedDelayed", 2);
826
+ ], n.prototype, "isFeatureListVisible", 2);
827
+ c([
828
+ b()
829
+ ], n.prototype, "isFeatureListInteractedWith", 2);
820
830
  n = c([
821
831
  O("maptiler-geocoder")
822
832
  ], n);
823
- const mt = [
833
+ const gt = [
824
834
  "adjustUrl",
825
835
  "apiKey",
826
836
  "apiUrl",
@@ -858,13 +868,13 @@ const mt = [
858
868
  "types",
859
869
  "reverseGeocodingTypes",
860
870
  "worldview"
861
- ], gt = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
862
- var yt = Object.getOwnPropertyDescriptor, vt = (t, e, i, o) => {
863
- for (var r = o > 1 ? void 0 : o ? yt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
864
- (a = t[s]) && (r = a(r) || r);
865
- return r;
871
+ ], yt = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
872
+ var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
873
+ for (var s = a > 1 ? void 0 : a ? vt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
874
+ (r = t[o]) && (s = r(s) || s);
875
+ return s;
866
876
  };
867
- let ne = class extends M {
877
+ let le = class extends F {
868
878
  render() {
869
879
  return z`
870
880
  <svg
@@ -880,16 +890,16 @@ let ne = class extends M {
880
890
  `;
881
891
  }
882
892
  };
883
- ne.styles = I`
884
- ${ce(gt)}
893
+ le.styles = I`
894
+ ${ne(yt)}
885
895
  `;
886
- ne = vt([
896
+ le = xt([
887
897
  O("maptiler-geocode-marker")
888
- ], ne);
898
+ ], le);
889
899
  function ke(t) {
890
- const e = Qe(
891
- q([
892
- Ne([
900
+ const e = Ke(
901
+ D([
902
+ Ze([
893
903
  [
894
904
  [180, 90],
895
905
  [-180, 90],
@@ -904,22 +914,22 @@ function ke(t) {
904
914
  if (!e)
905
915
  return;
906
916
  e.properties = { isMask: !0 };
907
- const i = N(be(t)), o = (i[2] - i[0]) / 360 / 1e3, r = i[0] < -180, s = i[2] > 180, a = Ke(t);
908
- if (a.features.length > 1 && (r || s))
909
- for (const f of a.features) {
910
- const L = N(be(f));
911
- if (s && L[0] < -180 + o)
912
- for (const w of f.geometry.coordinates)
913
- for (const S of w)
914
- S[0] += 360 - o;
915
- if (r && L[2] > 180 - o)
916
- for (const w of f.geometry.coordinates)
917
- for (const S of w)
918
- S[0] -= 360 - o;
917
+ const i = V(be(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = Ye(t);
918
+ if (r.features.length > 1 && (s || o))
919
+ for (const u of r.features) {
920
+ const y = V(be(u));
921
+ if (o && y[0] < -180 + a)
922
+ for (const T of u.geometry.coordinates)
923
+ for (const _ of T)
924
+ _[0] += 360 - a;
925
+ if (s && y[2] > 180 - a)
926
+ for (const T of u.geometry.coordinates)
927
+ for (const _ of T)
928
+ _[0] -= 360 - a;
919
929
  }
920
- return q([a.features.length < 2 ? t : Le(a) ?? t, e]);
930
+ return D([r.features.length < 2 ? t : Le(r) ?? t, e]);
921
931
  }
922
- const xt = {
932
+ const bt = {
923
933
  continental_marine: 4,
924
934
  country: 4,
925
935
  major_landform: 8,
@@ -943,7 +953,7 @@ const xt = {
943
953
  "poi.restaurant": 18,
944
954
  "poi.aerodrome": 13
945
955
  // TODO add many more
946
- }, bt = {
956
+ }, kt = {
947
957
  fill: {
948
958
  paint: {
949
959
  "fill-color": "#000",
@@ -962,8 +972,8 @@ const xt = {
962
972
  },
963
973
  filter: ["!", ["has", "isMask"]]
964
974
  }
965
- }, A = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", kt = he.Evented, wt = he.Marker, _t = he.Popup;
966
- class Gt extends kt {
975
+ }, A = "mtlr-gc-full-geom", we = "mtlr-gc-full-geom-fill", _e = "mtlr-gc-full-geom-line", wt = ce.Evented, _t = ce.Marker, Lt = ce.Popup;
976
+ class Rt extends wt {
967
977
  #e = {};
968
978
  #t;
969
979
  #i;
@@ -1053,7 +1063,7 @@ class Gt extends kt {
1053
1063
  },
1054
1064
  featureslisted: (e) => {
1055
1065
  const i = e.detail.features;
1056
- this.#o = i, this.#p(this.#o, void 0), this.#$(i), this.#s("featureslisted", e.detail);
1066
+ this.#o = i, this.#p(this.#o, void 0), this.#$(e), this.#s("featureslisted", e.detail);
1057
1067
  },
1058
1068
  featuresclear: () => {
1059
1069
  this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
@@ -1102,24 +1112,25 @@ class Gt extends kt {
1102
1112
  return super.fire({ type: e, ...i ?? {} });
1103
1113
  }
1104
1114
  #L(e) {
1105
- e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(N(e.bbox), 50, this.#h(e));
1115
+ e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#x(e.center, this.#h(e)) : this.#b(V(e.bbox), 50, this.#h(e));
1106
1116
  }
1107
- #$(e) {
1108
- if (!e || e.length === 0 || !this.#d) return;
1109
- const i = e.every((s) => s.matching_text), o = e.reduce(
1110
- (s, a) => i || !a.matching_text ? [Math.min(s[0], a.bbox[0]), Math.min(s[1], a.bbox[1]), Math.max(s[2], a.bbox[2]), Math.max(s[3], a.bbox[3])] : s,
1117
+ #$({ detail: { features: e, external: i } }) {
1118
+ if (!e || e.length === 0 || !this.#d || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
1119
+ return;
1120
+ const a = e.every((r) => r.matching_text), s = e.reduce(
1121
+ (r, u) => a || !u.matching_text ? [Math.min(r[0], u.bbox[0]), Math.min(r[1], u.bbox[1]), Math.max(r[2], u.bbox[2]), Math.max(r[3], u.bbox[3])] : r,
1111
1122
  [180, 90, -180, -90]
1112
- ), r = e.map((s) => this.#h(s)).filter((s) => s !== void 0).reduce((s, a) => s === void 0 ? a : Math.max(s, a), void 0);
1113
- this.#b(N(o), 50, r);
1123
+ ), o = e.map((r) => this.#h(r)).filter((r) => r !== void 0).reduce((r, u) => r === void 0 ? u : Math.max(r, u), void 0);
1124
+ this.#b(V(s), 50, o);
1114
1125
  }
1115
1126
  #h(e) {
1116
1127
  if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
1117
1128
  return;
1118
- const i = e.id.replace(/\..*/, ""), o = this.#e.zoom ?? xt;
1119
- return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((r, s) => {
1120
- const a = o[i + "." + s];
1121
- return r === void 0 ? a : a === void 0 ? r : Math.max(r, a);
1122
- }, void 0) : void 0) ?? o[i];
1129
+ const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? bt;
1130
+ return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
1131
+ const r = a[i + "." + o];
1132
+ return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
1133
+ }, void 0) : void 0) ?? a[i];
1123
1134
  }
1124
1135
  get #d() {
1125
1136
  return !!this.#e.flyTo || this.#e.flyTo === void 0;
@@ -1127,19 +1138,19 @@ class Gt extends kt {
1127
1138
  get #I() {
1128
1139
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1129
1140
  }
1130
- get #M() {
1141
+ get #F() {
1131
1142
  return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1132
1143
  }
1133
1144
  #x(e, i) {
1134
1145
  this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#I });
1135
1146
  }
1136
- #b(e, i, o) {
1147
+ #b(e, i, a) {
1137
1148
  this.#t?.fitBounds(
1138
1149
  [
1139
1150
  [e[0], e[1]],
1140
1151
  [e[2], e[3]]
1141
1152
  ],
1142
- { padding: i, ...o ? { maxZoom: o } : {}, ...this.#M }
1153
+ { padding: i, ...a ? { maxZoom: a } : {}, ...this.#F }
1143
1154
  );
1144
1155
  }
1145
1156
  #k(e) {
@@ -1154,62 +1165,62 @@ class Gt extends kt {
1154
1165
  #p(e, i) {
1155
1166
  if (!this.#t)
1156
1167
  return;
1157
- for (const r of this.#l.values())
1158
- r.remove();
1168
+ for (const s of this.#l.values())
1169
+ s.remove();
1159
1170
  this.#l = /* @__PURE__ */ new Map(), this.#n(void 0);
1160
- const o = () => {
1171
+ const a = () => {
1161
1172
  if (!i || !this.#t || this.#e.marker === !1 || this.#e.marker === null) return;
1162
- const r = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
1163
- r && this.#l.set(i, r);
1173
+ const s = this.#e.marker instanceof Function ? this.#e.marker(this.#t, i) : this.#f(this.#e.marker).setLngLat(i.center).addTo(this.#t);
1174
+ s && this.#l.set(i, s);
1164
1175
  };
1165
1176
  if (i?.geometry.type === "GeometryCollection") {
1166
- const r = i.geometry.geometries.filter(
1167
- (s) => s.type === "Polygon" || s.type === "MultiPolygon"
1177
+ const s = i.geometry.geometries.filter(
1178
+ (o) => o.type === "Polygon" || o.type === "MultiPolygon"
1168
1179
  );
1169
- if (r.length > 0) {
1170
- const s = Le(q(r.map((a) => Ze(a))));
1171
- if (s) {
1172
- const a = ke({ ...i, geometry: s.geometry });
1173
- a && this.#n(a);
1180
+ if (s.length > 0) {
1181
+ const o = Le(D(s.map((r) => Qe(r))));
1182
+ if (o) {
1183
+ const r = ke({ ...i, geometry: o.geometry });
1184
+ r && this.#n(r);
1174
1185
  }
1175
1186
  } else {
1176
- const s = i.geometry.geometries.filter(
1177
- (a) => a.type === "LineString" || a.type === "MultiLineString"
1187
+ const o = i.geometry.geometries.filter(
1188
+ (r) => r.type === "LineString" || r.type === "MultiLineString"
1178
1189
  );
1179
- s.length > 0 && this.#n({
1190
+ o.length > 0 && this.#n({
1180
1191
  ...i,
1181
- geometry: { type: "GeometryCollection", geometries: s }
1192
+ geometry: { type: "GeometryCollection", geometries: o }
1182
1193
  });
1183
1194
  }
1184
1195
  } else if (i?.geometry.type.endsWith("Polygon")) {
1185
- const r = ke(i);
1186
- r && this.#n(r), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
1187
- } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && o();
1196
+ const s = ke(i);
1197
+ s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
1198
+ } else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
1188
1199
  if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
1189
- for (const r of e ?? []) {
1190
- if (r.id === i?.id || r.place_type.includes("reverse"))
1200
+ for (const s of e ?? []) {
1201
+ if (s.id === i?.id || s.place_type.includes("reverse"))
1191
1202
  continue;
1192
- let s;
1203
+ let o;
1193
1204
  if (this.#e.showResultMarkers instanceof Function) {
1194
- if (s = this.#e.showResultMarkers(this.#t, r), !s)
1205
+ if (o = this.#e.showResultMarkers(this.#t, s), !o)
1195
1206
  continue;
1196
1207
  } else
1197
- s = this.#f(this.#e.showResultMarkers).setLngLat(r.center).setPopup(
1198
- new _t({
1208
+ o = this.#f(this.#e.showResultMarkers).setLngLat(s.center).setPopup(
1209
+ new Lt({
1199
1210
  offset: [1, -27],
1200
1211
  closeButton: !1,
1201
1212
  closeOnMove: !0,
1202
1213
  className: "maptiler-gc-popup"
1203
- }).setText(r.place_type[0] === "reverse" ? r.place_name : r.place_name.replace(/,.*/, ""))
1204
- ).addTo(this.#t), s.getElement().classList.add("marker-interactive");
1205
- const a = s.getElement();
1206
- a.addEventListener("click", (f) => {
1207
- f.stopPropagation(), this.#s("markerclick", { feature: r, marker: s });
1208
- }), a.addEventListener("mouseenter", () => {
1209
- this.#s("markermouseenter", { feature: r, marker: s }), s.togglePopup();
1210
- }), a.addEventListener("mouseleave", () => {
1211
- this.#s("markermouseleave", { feature: r, marker: s }), s.togglePopup();
1212
- }), a.classList.toggle("marker-fuzzy", !!r.matching_text), this.#l.set(r, s);
1214
+ }).setText(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
1215
+ ).addTo(this.#t), o.getElement().classList.add("marker-interactive");
1216
+ const r = o.getElement();
1217
+ r.addEventListener("click", (u) => {
1218
+ u.stopPropagation(), this.#s("markerclick", { feature: s, marker: o });
1219
+ }), r.addEventListener("mouseenter", () => {
1220
+ this.#s("markermouseenter", { feature: s, marker: o }), o.togglePopup();
1221
+ }), r.addEventListener("mouseleave", () => {
1222
+ this.#s("markermouseleave", { feature: s, marker: o }), o.togglePopup();
1223
+ }), r.classList.toggle("marker-fuzzy", !!s.matching_text), this.#l.set(s, o);
1213
1224
  }
1214
1225
  }
1215
1226
  #O(e) {
@@ -1223,7 +1234,7 @@ class Gt extends kt {
1223
1234
  return;
1224
1235
  }
1225
1236
  const e = this.#T(), i = this.#t.getSource(A);
1226
- !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? q([])) : this.#a && this.#t.addSource(A, {
1237
+ !e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? D([])) : this.#a && this.#t.addSource(A, {
1227
1238
  type: "geojson",
1228
1239
  data: this.#a
1229
1240
  }), !this.#t.getLayer(we) && e.fill && this.#t.addLayer({
@@ -1242,29 +1253,29 @@ class Gt extends kt {
1242
1253
  this.#a = e, this.#u();
1243
1254
  }
1244
1255
  #f(e) {
1245
- return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new wt(e);
1256
+ return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new _t(e);
1246
1257
  }
1247
1258
  #T() {
1248
1259
  const { fullGeometryStyle: e } = this.#e;
1249
- if (e === !0 || e === void 0) return bt;
1260
+ if (e === !0 || e === void 0) return kt;
1250
1261
  if (!(e === !1 || e === null))
1251
1262
  return e;
1252
1263
  }
1253
1264
  }
1254
1265
  export {
1255
- bt as DEFAULT_GEOMETRY_STYLE,
1256
- Gt as GeocodingControl,
1257
- Gt as MaplibreglGeocodingControl,
1258
- ee as MaptilerGeocodeClearIconElement,
1259
- te as MaptilerGeocodeFailIconElement,
1260
- ie as MaptilerGeocodeLoadingIconElement,
1261
- ne as MaptilerGeocodeMarkerElement,
1262
- se as MaptilerGeocodeReverseGeocodingIconElement,
1263
- re as MaptilerGeocodeSearchIconElement,
1266
+ kt as DEFAULT_GEOMETRY_STYLE,
1267
+ Rt as GeocodingControl,
1268
+ Rt as MaplibreglGeocodingControl,
1269
+ J as MaptilerGeocodeClearIconElement,
1270
+ X as MaptilerGeocodeFailIconElement,
1271
+ ee as MaptilerGeocodeLoadingIconElement,
1272
+ le as MaptilerGeocodeMarkerElement,
1273
+ te as MaptilerGeocodeReverseGeocodingIconElement,
1274
+ ie as MaptilerGeocodeSearchIconElement,
1264
1275
  n as MaptilerGeocoderElement,
1265
1276
  we as RESULT_LAYER_FILL,
1266
1277
  _e as RESULT_LAYER_LINE,
1267
1278
  A as RESULT_SOURCE,
1268
- xt as ZOOM_DEFAULTS
1279
+ bt as ZOOM_DEFAULTS
1269
1280
  };
1270
1281
  //# sourceMappingURL=maplibregl.js.map