@maptiler/geocoding-control 3.0.0-rc.6 → 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.
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { css as L, LitElement as F, svg as q, html as f, unsafeCSS as ge, nothing as H } from "lit";
2
- import { customElement as O, property as h, state as b, query as Me } from "lit/decorators.js";
3
- import { convert as Pe } from "geo-coordinates-parser";
1
+ import { css as L, LitElement as F, svg as D, html as f, unsafeCSS as fe, nothing as Z } from "lit";
2
+ import { customElement as O, property as h, state as v, query as Ue } from "lit/decorators.js";
3
+ import { convert as Be } from "geo-coordinates-parser";
4
4
  import { classMap as j } from "lit/directives/class-map.js";
5
- import { repeat as Be } from "lit/directives/repeat.js";
5
+ import { repeat as Me } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
7
  import { styleMap as Ee } from "lit/directives/style-map.js";
8
- var Ge = Object.getOwnPropertyDescriptor, De = (e, t, i, n) => {
8
+ var Ge = Object.getOwnPropertyDescriptor, We = (e, t, i, n) => {
9
9
  for (var s = n > 1 ? void 0 : n ? Ge(t, i) : t, p = e.length - 1, l; p >= 0; p--)
10
10
  (l = e[p]) && (s = l(s) || s);
11
11
  return s;
12
12
  };
13
- let J = class extends F {
13
+ let Q = class extends F {
14
14
  render() {
15
- return q`
15
+ return D`
16
16
  <svg viewBox="0 0 14 14" width="13" height="13">
17
17
  <path
18
18
  d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
@@ -21,23 +21,23 @@ let J = class extends F {
21
21
  `;
22
22
  }
23
23
  };
24
- J.styles = L`
24
+ Q.styles = L`
25
25
  svg {
26
26
  display: block;
27
27
  fill: var(--color-icon-button);
28
28
  }
29
29
  `;
30
- J = De([
30
+ Q = We([
31
31
  O("maptiler-geocode-clear-icon")
32
- ], J);
32
+ ], Q);
33
33
  var je = Object.getOwnPropertyDescriptor, Ae = (e, t, i, n) => {
34
34
  for (var s = n > 1 ? void 0 : n ? je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
35
35
  (l = e[p]) && (s = l(s) || s);
36
36
  return s;
37
37
  };
38
- let X = class extends F {
38
+ let H = class extends F {
39
39
  render() {
40
- return q`
40
+ return D`
41
41
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
42
42
  <path
43
43
  d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
@@ -46,21 +46,21 @@ let X = class extends F {
46
46
  `;
47
47
  }
48
48
  };
49
- X.styles = L`
49
+ H.styles = L`
50
50
  svg {
51
51
  display: block;
52
52
  fill: #e15042;
53
53
  }
54
54
  `;
55
- X = Ae([
55
+ H = Ae([
56
56
  O("maptiler-geocode-fail-icon")
57
- ], X);
58
- var Re = Object.getOwnPropertyDescriptor, We = (e, t, i, n) => {
57
+ ], H);
58
+ var Re = Object.getOwnPropertyDescriptor, Ve = (e, t, i, n) => {
59
59
  for (var s = n > 1 ? void 0 : n ? Re(t, i) : t, p = e.length - 1, l; p >= 0; p--)
60
60
  (l = e[p]) && (s = l(s) || s);
61
61
  return s;
62
62
  };
63
- let Y = class extends F {
63
+ let J = class extends F {
64
64
  render() {
65
65
  return f`
66
66
  <div>
@@ -72,7 +72,7 @@ let Y = class extends F {
72
72
  `;
73
73
  }
74
74
  };
75
- Y.styles = L`
75
+ J.styles = L`
76
76
  div {
77
77
  position: absolute;
78
78
  left: 50%;
@@ -99,17 +99,17 @@ Y.styles = L`
99
99
  }
100
100
  }
101
101
  `;
102
- Y = We([
102
+ J = Ve([
103
103
  O("maptiler-geocode-loading-icon")
104
- ], Y);
105
- var Ve = Object.getOwnPropertyDescriptor, ze = (e, t, i, n) => {
106
- for (var s = n > 1 ? void 0 : n ? Ve(t, i) : t, p = e.length - 1, l; p >= 0; p--)
104
+ ], J);
105
+ var De = Object.getOwnPropertyDescriptor, ze = (e, t, i, n) => {
106
+ for (var s = n > 1 ? void 0 : n ? De(t, i) : t, p = e.length - 1, l; p >= 0; p--)
107
107
  (l = e[p]) && (s = l(s) || s);
108
108
  return s;
109
109
  };
110
- let ee = class extends F {
110
+ let X = class extends F {
111
111
  render() {
112
- return q`
112
+ return D`
113
113
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
114
114
  <path
115
115
  d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
@@ -118,23 +118,23 @@ let ee = class extends F {
118
118
  `;
119
119
  }
120
120
  };
121
- ee.styles = L`
121
+ X.styles = L`
122
122
  svg {
123
123
  display: block;
124
124
  fill: var(--color-icon-button);
125
125
  }
126
126
  `;
127
- ee = ze([
127
+ X = ze([
128
128
  O("maptiler-geocode-reverse-geocoding-icon")
129
- ], ee);
129
+ ], X);
130
130
  var qe = Object.getOwnPropertyDescriptor, Ne = (e, t, i, n) => {
131
131
  for (var s = n > 1 ? void 0 : n ? qe(t, i) : t, p = e.length - 1, l; p >= 0; p--)
132
132
  (l = e[p]) && (s = l(s) || s);
133
133
  return s;
134
134
  };
135
- let te = class extends F {
135
+ let Y = class extends F {
136
136
  render() {
137
- return q`
137
+ return D`
138
138
  <svg
139
139
  xmlns="http://www.w3.org/2000/svg"
140
140
  width="13"
@@ -147,7 +147,7 @@ let te = class extends F {
147
147
  `;
148
148
  }
149
149
  };
150
- te.styles = L`
150
+ Y.styles = L`
151
151
  circle {
152
152
  stroke-width: 1.875;
153
153
  fill: none;
@@ -163,23 +163,23 @@ te.styles = L`
163
163
  stroke: var(--color-icon-button);
164
164
  }
165
165
  `;
166
- te = Ne([
166
+ Y = Ne([
167
167
  O("maptiler-geocode-search-icon")
168
- ], te);
168
+ ], Y);
169
169
  function Ke(e, t, i) {
170
170
  const n = t[1], s = t[0], p = n - s;
171
171
  return e === n && i ? e : ((e - s) % p + p) % p + s;
172
172
  }
173
- let P;
173
+ let U;
174
174
  async function Ze(e, t, i) {
175
175
  for (const n of t ?? [])
176
176
  if (!(e && (n.minZoom != null && n.minZoom > e[0] || n.maxZoom != null && n.maxZoom < e[0]))) {
177
177
  if (n.type === "fixed")
178
178
  return n.coordinates.join(",");
179
179
  if (n.type === "client-geolocation")
180
- if (P && n.cachedLocationExpiry && P.time + n.cachedLocationExpiry > Date.now()) {
181
- if (P.coords)
182
- return P.coords;
180
+ if (U && n.cachedLocationExpiry && U.time + n.cachedLocationExpiry > Date.now()) {
181
+ if (U.coords)
182
+ return U.coords;
183
183
  } else {
184
184
  let s;
185
185
  try {
@@ -187,18 +187,18 @@ async function Ze(e, t, i) {
187
187
  i.signal.addEventListener("abort", () => {
188
188
  l(Error("aborted"));
189
189
  }), navigator.geolocation.getCurrentPosition(
190
- (_) => {
191
- p([_.coords.longitude, _.coords.latitude].map((v) => v.toFixed(6)).join(","));
190
+ ($) => {
191
+ p([$.coords.longitude, $.coords.latitude].map((x) => x.toFixed(6)).join(","));
192
192
  },
193
- (_) => {
194
- l(_);
193
+ ($) => {
194
+ l($);
195
195
  },
196
196
  n
197
197
  );
198
198
  }), s;
199
199
  } catch {
200
200
  } finally {
201
- n.cachedLocationExpiry && (P = {
201
+ n.cachedLocationExpiry && (U = {
202
202
  time: Date.now(),
203
203
  coords: s
204
204
  });
@@ -213,20 +213,20 @@ async function Ze(e, t, i) {
213
213
  }
214
214
  }
215
215
  const Qe = ".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)}}";
216
- var He = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, me = (e) => {
216
+ var He = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, ge = (e) => {
217
217
  throw TypeError(e);
218
- }, $ = (e, t, i, n) => {
218
+ }, _ = (e, t, i, n) => {
219
219
  for (var s = n > 1 ? void 0 : n ? Je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
220
220
  (l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
221
221
  return n && s && He(t, i, s), s;
222
- }, ye = (e, t, i) => t.has(e) || me("Cannot " + i), u = (e, t, i) => (ye(e, t, "read from private field"), i ? i.call(e) : t.get(e)), Xe = (e, t, i) => t.has(e) ? me("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), U = (e, t, i) => (ye(e, t, "access private method"), i), d, W, B, g, ve, xe, oe, ie;
223
- const be = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, we = be ? "@2x" : "", T = be ? 2 : 1;
224
- let I, _e, w = class extends F {
222
+ }, me = (e, t, i) => t.has(e) || ge("Cannot " + i), u = (e, t, i) => (me(e, t, "read from private field"), i ? i.call(e) : t.get(e)), Xe = (e, t, i) => t.has(e) ? ge("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), C = (e, t, i) => (me(e, t, "access private method"), i), d, A, M, g, ye, ve, re, ee;
223
+ const xe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, be = xe ? "@2x" : "", T = xe ? 2 : 1;
224
+ let I, we, w = class extends F {
225
225
  constructor() {
226
226
  super(...arguments), Xe(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
227
227
  }
228
228
  willUpdate(e) {
229
- e.has("feature") && u(this, d, W) && (this.index = u(this, d, W).length, U(this, d, oe).call(this));
229
+ e.has("feature") && u(this, d, A) && (this.index = u(this, d, A).length, C(this, d, re).call(this));
230
230
  }
231
231
  render() {
232
232
  return f`
@@ -244,90 +244,90 @@ let I, _e, w = class extends F {
244
244
  style=${Ee({
245
245
  width: `${this.spriteIcon.width / T}px`,
246
246
  height: `${this.spriteIcon.height / T}px`,
247
- backgroundImage: `url(${this.iconsBaseUrl}sprite${we}.png)`,
247
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${be}.png)`,
248
248
  backgroundPosition: `-${this.spriteIcon.x / T}px -${this.spriteIcon.y / T}px`,
249
249
  backgroundSize: `${I.width / T}px ${I.height / T}px`
250
250
  })}
251
251
  title=${u(this, d, g)}
252
252
  />
253
- ` : this.imageUrl ? f` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${U(this, d, xe)} />` : this.feature?.address ? f` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? f` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? f` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? f` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? f` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d, B) ? f` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : f` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> `}
253
+ ` : this.imageUrl ? f` <img src=${this.imageUrl} alt=${this.category} title=${u(this, d, g)} @error=${C(this, d, ve)} />` : this.feature?.address ? f` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? f` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? f` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? f` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? f` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : u(this, d, M) ? f` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> ` : f` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, d, g)} title=${u(this, d, g)} /> `}
254
254
 
255
255
  <span class="texts">
256
256
  <span>
257
- <span class="primary"> ${u(this, d, B) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
257
+ <span class="primary"> ${u(this, d, M) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
258
258
 
259
- ${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) ? f` <span class="secondary"> ${u(this, d, g)} </span> ` : H}
259
+ ${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, M) ? f` <span class="secondary"> ${u(this, d, g)} </span> ` : Z}
260
260
  </span>
261
261
 
262
- <span class="line2"> ${u(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
262
+ <span class="line2"> ${u(this, d, M) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
263
263
  </span>
264
264
  </li>
265
265
  `;
266
266
  }
267
267
  };
268
268
  d = /* @__PURE__ */ new WeakSet();
269
- W = function() {
269
+ A = function() {
270
270
  return this.feature?.properties?.categories;
271
271
  };
272
- B = function() {
272
+ M = function() {
273
273
  return this.feature?.place_type[0] === "reverse";
274
274
  };
275
275
  g = function() {
276
276
  return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
277
277
  };
278
- ve = function() {
279
- _e ??= fetch(`${this.iconsBaseUrl}sprite${we}.json`).then((e) => e.json()).then((e) => {
278
+ ye = function() {
279
+ we ??= fetch(`${this.iconsBaseUrl}sprite${be}.json`).then((e) => e.json()).then((e) => {
280
280
  I = e;
281
281
  }).catch(() => {
282
282
  I = null;
283
283
  });
284
284
  };
285
- xe = function() {
286
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), U(this, d, oe).call(this);
285
+ ve = function() {
286
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, re).call(this);
287
287
  };
288
- oe = function() {
289
- I !== void 0 ? U(this, d, ie).call(this) : (U(this, d, ve).call(this), _e?.then(() => {
290
- U(this, d, ie).call(this);
288
+ re = function() {
289
+ I !== void 0 ? C(this, d, ee).call(this) : (C(this, d, ye).call(this), we?.then(() => {
290
+ C(this, d, ee).call(this);
291
291
  }));
292
292
  };
293
- ie = function() {
293
+ ee = function() {
294
294
  do {
295
- if (this.index--, this.category = u(this, d, W)?.[this.index], this.spriteIcon = this.category ? I?.icons[this.category] : void 0, this.spriteIcon)
295
+ if (this.index--, this.category = u(this, d, A)?.[this.index], this.spriteIcon = this.category ? I?.icons[this.category] : void 0, this.spriteIcon)
296
296
  break;
297
297
  this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
298
298
  } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
299
299
  };
300
300
  w.styles = L`
301
- ${ge(Qe)}
301
+ ${fe(Qe)}
302
302
  `;
303
- $([
303
+ _([
304
304
  h({ type: Object })
305
305
  ], w.prototype, "feature", 2);
306
- $([
306
+ _([
307
307
  h({ type: String })
308
308
  ], w.prototype, "itemStyle", 2);
309
- $([
309
+ _([
310
310
  h({ type: String })
311
311
  ], w.prototype, "showPlaceType", 2);
312
- $([
312
+ _([
313
313
  h({ attribute: !1 })
314
314
  ], w.prototype, "missingIconsCache", 2);
315
- $([
315
+ _([
316
316
  h({ type: String })
317
317
  ], w.prototype, "iconsBaseUrl", 2);
318
- $([
319
- b()
318
+ _([
319
+ v()
320
320
  ], w.prototype, "category", 2);
321
- $([
322
- b()
321
+ _([
322
+ v()
323
323
  ], w.prototype, "imageUrl", 2);
324
- $([
325
- b()
324
+ _([
325
+ v()
326
326
  ], w.prototype, "spriteIcon", 2);
327
- $([
328
- b()
327
+ _([
328
+ v()
329
329
  ], w.prototype, "index", 2);
330
- w = $([
330
+ w = _([
331
331
  O("maptiler-geocoder-feature-item")
332
332
  ], w);
333
333
  const Ye = "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}";
@@ -337,13 +337,13 @@ var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, $e = (e) =
337
337
  for (var s = n > 1 ? void 0 : n ? tt(t, i) : t, p = e.length - 1, l; p >= 0; p--)
338
338
  (l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
339
339
  return n && s && et(t, i, s), s;
340
- }, ae = (e, t, i) => t.has(e) || $e("Cannot " + i), x = (e, t, i) => (ae(e, t, "read from private field"), i ? i.call(e) : t.get(e)), C = (e, t, i) => t.has(e) ? $e("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), A = (e, t, i, n) => (ae(e, t, "write to private field"), t.set(e, i), i), c = (e, t, i) => (ae(e, t, "access private method"), i), V, R, E, se, G, r, z, ke, Ie, le, y, ne, N, ce, he, k, pe, K, Le, re, Fe, Oe, Se, Te, Ce;
340
+ }, oe = (e, t, i) => t.has(e) || $e("Cannot " + i), b = (e, t, i) => (oe(e, t, "read from private field"), i ? i.call(e) : t.get(e)), B = (e, t, i) => t.has(e) ? $e("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), te = (e, t, i, n) => (oe(e, t, "write to private field"), t.set(e, i), i), c = (e, t, i) => (oe(e, t, "access private method"), i), R, E, ie, G, r, V, _e, ae, y, le, z, ne, ce, k, he, q, ke, se, Ie, Le, Fe, Oe, Se, Te, Ce;
341
341
  let o = class extends F {
342
342
  constructor() {
343
- super(...arguments), C(this, r), 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, V, !1), C(this, R, !1), C(this, E), C(this, se, /* @__PURE__ */ new Set()), C(this, G);
343
+ super(...arguments), B(this, r), 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, B(this, R, !1), B(this, E), B(this, ie, /* @__PURE__ */ new Set()), B(this, G);
344
344
  }
345
345
  firstUpdated() {
346
- A(this, V, !0);
346
+ te(this, R, !0);
347
347
  }
348
348
  /**
349
349
  * Set the options of this instance.
@@ -362,7 +362,7 @@ let o = class extends F {
362
362
  * @param value text to set
363
363
  */
364
364
  setQuery(e) {
365
- c(this, r, he).call(this, e, { external: !0 }), c(this, r, ce).call(this);
365
+ c(this, r, ce).call(this, e, { external: !0 }), c(this, r, ne).call(this);
366
366
  }
367
367
  /**
368
368
  * Set the content of search input box and immediately submit it.
@@ -370,7 +370,7 @@ let o = class extends F {
370
370
  * @param value text to set and submit
371
371
  */
372
372
  submitQuery(e) {
373
- c(this, r, pe).call(this, e);
373
+ c(this, r, he).call(this, e);
374
374
  }
375
375
  /**
376
376
  * Clear search result list.
@@ -400,27 +400,25 @@ let o = class extends F {
400
400
  }
401
401
  /** @internal */
402
402
  handleMapChange(e) {
403
- A(this, G, e);
403
+ te(this, G, e);
404
404
  }
405
405
  /** @internal */
406
406
  handleMapClick(e) {
407
- this.reverseActive && c(this, r, Le).call(this, e);
407
+ this.reverseActive && c(this, r, ke).call(this, e);
408
408
  }
409
409
  willUpdate(e) {
410
- e.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), e.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((t) => e.has(t)) && this.picked && (this.clearListOnPick && c(this, r, k).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((t) => e.has(t)) && x(this, r, le) && (c(this, r, k).call(this), this.error = void 0), ["focused"].some((t) => e.has(t)) && setTimeout(() => {
411
- this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
412
- }, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((t) => e.has(t)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((t) => e.has(t)) && c(this, r, y).call(this, "select", { feature: x(this, r, z) }), ["picked"].some((t) => e.has(t)) && this.picked && this.picked.id !== e.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? c(this, r, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
410
+ e.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), e.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((t) => e.has(t)) && this.picked && (this.clearListOnPick && c(this, r, k).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((t) => e.has(t)) && b(this, r, ae) && (c(this, r, k).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((t) => e.has(t)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((t) => e.has(t)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((t) => e.has(t)) && c(this, r, y).call(this, "select", { feature: b(this, r, V) }), ["picked"].some((t) => e.has(t)) && this.picked && this.picked.id !== e.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? c(this, r, q).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
413
411
  () => {
414
412
  c(this, r, y).call(this, "pick", { feature: this.picked });
415
413
  },
416
414
  (t) => {
417
415
  t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this, r, y).call(this, "pick", { feature: this.picked }));
418
416
  }
419
- ), ["listFeatures", "focusedDelayed"].some((t) => e.has(t)) && (x(this, r, ke) ? (c(this, r, y).call(this, "featuresshow"), A(this, R, !0)) : x(this, R) && c(this, r, y).call(this, "featureshide")), ["reverseActive"].some((t) => e.has(t)) && c(this, r, y).call(this, "reversetoggle", { reverse: this.reverseActive });
417
+ ), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((t) => e.has(t)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((t) => e.has(t)) && (this.isFeatureListVisible ? c(this, r, y).call(this, "featuresshow") : c(this, r, y).call(this, "featureshide")), ["reverseActive"].some((t) => e.has(t)) && c(this, r, y).call(this, "reversetoggle", { reverse: this.reverseActive });
420
418
  }
421
419
  render() {
422
420
  return f`
423
- <form @submit=${c(this, r, ne)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
421
+ <form @submit=${c(this, r, le)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
424
422
  <div class="input-group">
425
423
  <button
426
424
  class="search-button"
@@ -437,15 +435,15 @@ let o = class extends F {
437
435
  @focus=${() => this.focused = !0}
438
436
  @blur=${() => this.focused = !1}
439
437
  @click=${() => this.focused = !0}
440
- @keydown=${c(this, r, re)}
441
- @input=${c(this, r, Fe)}
438
+ @keydown=${c(this, r, se)}
439
+ @input=${c(this, r, Ie)}
442
440
  @change=${() => this.picked = void 0}
443
441
  placeholder=${this.placeholder ?? "Search"}
444
442
  aria-label=${this.placeholder ?? "Search"}
445
443
  />
446
444
 
447
445
  <div class="clear-button-container ${j({ displayable: this.searchValue !== "" })}">
448
- ${x(this, r, Ie) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
446
+ ${b(this, r, _e) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
449
447
  <button type="button" @click=${c(this, r, Ce)} title=${this.clearButtonTitle ?? "clear"}>
450
448
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
451
449
  </button>
@@ -461,7 +459,7 @@ let o = class extends F {
461
459
  >
462
460
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
463
461
  </button>
464
- ` : H}
462
+ ` : Z}
465
463
 
466
464
  <!-- <slot /> -->
467
465
  </div>
@@ -476,7 +474,7 @@ let o = class extends F {
476
474
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
477
475
  </button>
478
476
  </div>
479
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? f`
477
+ ` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? Z : this.listFeatures.length === 0 ? f`
480
478
  <div class="no-results">
481
479
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
482
480
 
@@ -485,8 +483,15 @@ let o = class extends F {
485
483
  </div>
486
484
  </div>
487
485
  ` : f`
488
- <ul class="options ${j({ "open-on-top": this.openListOnTop })}" @mouseleave=${c(this, r, Te)} @keydown=${c(this, r, re)} role="listbox">
489
- ${Be(
486
+ <ul
487
+ class="options ${j({ "open-on-top": this.openListOnTop })}"
488
+ @pointerleave=${c(this, r, Oe)}
489
+ @pointerdown=${c(this, r, Se)}
490
+ @pointerup=${c(this, r, Te)}
491
+ @keydown=${c(this, r, se)}
492
+ role="listbox"
493
+ >
494
+ ${Me(
490
495
  this.listFeatures,
491
496
  (e) => e.id + (e.address ? "," + e.address : ""),
492
497
  (e, t) => f`
@@ -494,17 +499,15 @@ let o = class extends F {
494
499
  .feature=${e}
495
500
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
496
501
  itemStyle=${this.selectedItemIndex === t ? "selected" : this.picked?.id === e.id ? "picked" : "default"}
497
- @mouseenter=${() => {
498
- c(this, r, Se).call(this, t);
502
+ @pointerenter=${() => {
503
+ c(this, r, Fe).call(this, t);
499
504
  }}
500
505
  @select=${() => {
501
- c(this, r, Oe).call(this, e);
506
+ c(this, r, Le).call(this, e);
502
507
  }}
503
- .missingIconsCache=${x(this, se)}
504
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
505
- >
506
- ${e.place_name}
507
- </maptiler-geocoder-feature-item>
508
+ .missingIconsCache=${b(this, ie)}
509
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
510
+ />
508
511
  `
509
512
  )}
510
513
  </ul>
@@ -513,26 +516,22 @@ let o = class extends F {
513
516
  `;
514
517
  }
515
518
  };
516
- V = /* @__PURE__ */ new WeakMap();
517
519
  R = /* @__PURE__ */ new WeakMap();
518
520
  E = /* @__PURE__ */ new WeakMap();
519
- se = /* @__PURE__ */ new WeakMap();
521
+ ie = /* @__PURE__ */ new WeakMap();
520
522
  G = /* @__PURE__ */ new WeakMap();
521
523
  r = /* @__PURE__ */ new WeakSet();
522
- z = function() {
524
+ V = function() {
523
525
  return this.listFeatures?.[this.selectedItemIndex];
524
526
  };
525
- ke = function() {
526
- return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
527
- };
528
- Ie = function() {
527
+ _e = function() {
529
528
  return this.abortController !== void 0;
530
529
  };
531
- le = function() {
530
+ ae = function() {
532
531
  return this.searchValue.length < (this.minLength ?? 2);
533
532
  };
534
533
  y = function(e, ...[t]) {
535
- x(this, V) && this.dispatchEvent(
534
+ b(this, R) && this.dispatchEvent(
536
535
  new CustomEvent(e, {
537
536
  bubbles: !0,
538
537
  composed: !0,
@@ -540,30 +539,30 @@ y = function(e, ...[t]) {
540
539
  })
541
540
  );
542
541
  };
543
- ne = function(e) {
544
- e?.preventDefault(), this.focused = !1, clearTimeout(x(this, E)), 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 && c(this, r, K).call(this, this.searchValue, { exact: !0, external: e === void 0 }).then(() => {
542
+ le = function(e) {
543
+ e?.preventDefault(), this.focused = !1, clearTimeout(b(this, E)), 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 && c(this, r, q).call(this, this.searchValue, { exact: !0, external: e === void 0 }).then(() => {
545
544
  this.picked = void 0;
546
545
  }).catch((t) => this.error = t);
547
546
  };
548
- N = function(e) {
547
+ z = function(e) {
549
548
  try {
550
- return Pe(e, 6);
549
+ return Be(e, 6);
551
550
  } catch {
552
551
  return !1;
553
552
  }
554
553
  };
555
- ce = function() {
554
+ ne = function() {
556
555
  setTimeout(() => {
557
556
  this.input.focus(), this.focused = !0, this.input.select();
558
557
  });
559
558
  };
560
- he = function(e, { external: t = !1 } = {}) {
561
- if (this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, N).call(this, e) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
562
- if (clearTimeout(x(this, E)), x(this, r, le))
559
+ ce = function(e, { external: t = !1 } = {}) {
560
+ if (this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, z).call(this, e) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
561
+ if (clearTimeout(b(this, E)), b(this, r, ae))
563
562
  return;
564
563
  const i = this.searchValue;
565
- A(this, E, window.setTimeout(() => {
566
- c(this, r, K).call(this, i, { external: t }).catch((n) => this.error = n);
564
+ te(this, E, window.setTimeout(() => {
565
+ c(this, r, q).call(this, i, { external: t }).catch((n) => this.error = n);
567
566
  }, this.debounceSearch ?? 200));
568
567
  } else
569
568
  c(this, r, k).call(this);
@@ -571,47 +570,47 @@ he = function(e, { external: t = !1 } = {}) {
571
570
  k = function() {
572
571
  this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, r, y).call(this, "featuresclear"));
573
572
  };
574
- pe = function(e) {
575
- this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, N).call(this, e) }), this.selectedItemIndex = -1, c(this, r, ne).call(this);
573
+ he = function(e) {
574
+ this.searchValue = e, c(this, r, y).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, r, z).call(this, e) }), this.selectedItemIndex = -1, c(this, r, le).call(this);
576
575
  };
577
- K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
576
+ q = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
578
577
  this.error = void 0, this.abortController?.abort();
579
578
  const s = new AbortController();
580
579
  this.abortController = s;
581
580
  try {
582
- const p = this.apiUrl ?? "https://api.maptiler.com/geocoding", l = c(this, r, N).call(this, e), _ = new URL(p + "/" + encodeURIComponent(l ? `${l.decimalLongitude},${l.decimalLatitude}` : e) + ".json"), v = _.searchParams;
583
- this.language !== void 0 && v.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
584
- const [Z] = x(this, G) ?? [void 0];
581
+ const p = this.apiUrl ?? "https://api.maptiler.com/geocoding", l = c(this, r, z).call(this, e), $ = new URL(p + "/" + encodeURIComponent(l ? `${l.decimalLongitude},${l.decimalLatitude}` : e) + ".json"), x = $.searchParams;
582
+ this.language !== void 0 && x.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
583
+ const [N] = b(this, G) ?? [void 0];
585
584
  let S = (!l || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
586
- (m) => typeof m == "string" ? m : Z === void 0 || (m[0] ?? 0) <= Z && Z < (m[1] ?? 1 / 0) ? m[2] : void 0
585
+ (m) => typeof m == "string" ? m : N === void 0 || (m[0] ?? 0) <= N && N < (m[1] ?? 1 / 0) ? m[2] : void 0
587
586
  ).filter((m) => m !== void 0);
588
- S && (S = [...new Set(S)], v.set("types", S.join(",")));
589
- const de = !l || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
590
- if (de && v.set("excludeTypes", String(de)), this.bbox && v.set("bbox", this.bbox.map((m) => m.toFixed(6)).join(",")), this.country && v.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && v.set("worldview", this.worldview), !t && !l) {
591
- const m = this.proximity ?? [{ type: "server-geolocation" }], fe = await Ze(x(this, G), m, s);
592
- fe && v.set("proximity", fe), (i || this.showResultsWhileTyping === !1) && v.set("autocomplete", "false"), v.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
587
+ S && (S = [...new Set(S)], x.set("types", S.join(",")));
588
+ const pe = !l || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
589
+ if (pe && x.set("excludeTypes", String(pe)), this.bbox && x.set("bbox", this.bbox.map((m) => m.toFixed(6)).join(",")), this.country && x.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && x.set("worldview", this.worldview), !t && !l) {
590
+ const m = this.proximity ?? [{ type: "server-geolocation" }], ue = await Ze(b(this, G), m, s);
591
+ ue && x.set("proximity", ue), (i || this.showResultsWhileTyping === !1) && x.set("autocomplete", "false"), x.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
593
592
  }
594
- const ue = this.limit ?? 5, Q = this.reverseGeocodingLimit ?? ue;
595
- Q > 1 && S?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), l ? (Q === 1 || this.exhaustiveReverseGeocoding || S?.length === 1) && v.set("limit", String(Q)) : v.set("limit", String(ue)), this.apiKey && v.set("key", this.apiKey), this.adjustUrl?.(_);
596
- const Ue = _.searchParams.get("types") === "" && _.searchParams.get("excludeTypes") !== "true", D = _.toString();
597
- if (D === this.lastSearchUrl) {
598
- t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, r, z)?.id && (this.selectedItemIndex = -1));
593
+ const de = this.limit ?? 5, K = this.reverseGeocodingLimit ?? de;
594
+ K > 1 && S?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), l ? (K === 1 || this.exhaustiveReverseGeocoding || S?.length === 1) && x.set("limit", String(K)) : x.set("limit", String(de)), this.apiKey && x.set("key", this.apiKey), this.adjustUrl?.($);
595
+ const Pe = $.searchParams.get("types") === "" && $.searchParams.get("excludeTypes") !== "true", W = $.toString();
596
+ if (W === this.lastSearchUrl) {
597
+ t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.listFeatures[this.selectedItemIndex]?.id !== b(this, r, V)?.id && (this.selectedItemIndex = -1));
599
598
  return;
600
599
  }
601
- c(this, r, y).call(this, "request", { urlObj: _ }), this.lastSearchUrl = D;
602
- let M;
603
- if (Ue)
604
- M = { type: "FeatureCollection", features: [] };
600
+ c(this, r, y).call(this, "request", { urlObj: $ }), this.lastSearchUrl = W;
601
+ let P;
602
+ if (Pe)
603
+ P = { type: "FeatureCollection", features: [] };
605
604
  else {
606
- const m = await fetch(D, {
605
+ const m = await fetch(W, {
607
606
  signal: s.signal,
608
607
  ...this.fetchParameters
609
608
  });
610
609
  if (!m.ok)
611
610
  throw new Error(await m.text());
612
- M = await m.json();
611
+ P = await m.json();
613
612
  }
614
- c(this, r, y).call(this, "response", { url: D, featureCollection: M }), t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = M.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = M.features.filter(this.filter ?? (() => !0)), l && this.listFeatures.unshift({
613
+ c(this, r, y).call(this, "response", { url: W, featureCollection: P }), t ? (this.clearListOnPick && c(this, r, k).call(this), this.picked = P.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = P.features.filter(this.filter ?? (() => !0)), l && this.listFeatures.unshift({
615
614
  type: "Feature",
616
615
  properties: {},
617
616
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
@@ -627,7 +626,7 @@ K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
627
626
  type: "Point",
628
627
  coordinates: [l.decimalLongitude, l.decimalLatitude]
629
628
  }
630
- }), c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, r, z)?.id && (this.selectedItemIndex = -1), l && this.input.focus());
629
+ }), c(this, r, y).call(this, "featureslisted", { features: this.listFeatures, external: n }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== b(this, r, V)?.id && (this.selectedItemIndex = -1), l && this.input.focus());
631
630
  } catch (p) {
632
631
  if (p && typeof p == "object" && "name" in p && p.name === "AbortError")
633
632
  return;
@@ -636,32 +635,40 @@ K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
636
635
  s === this.abortController && (this.abortController = void 0);
637
636
  }
638
637
  };
639
- Le = function(e) {
640
- this.reverseActive = this.enableReverse === "always", c(this, r, k).call(this), this.picked = void 0, c(this, r, pe).call(this, `${e[1].toFixed(6)}, ${Ke(e[0], [-180, 180], !0).toFixed(6)}`), c(this, r, ce).call(this);
638
+ ke = function(e) {
639
+ this.reverseActive = this.enableReverse === "always", c(this, r, k).call(this), this.picked = void 0, c(this, r, he).call(this, `${e[1].toFixed(6)}, ${Ke(e[0], [-180, 180], !0).toFixed(6)}`), c(this, r, ne).call(this);
641
640
  };
642
- re = function(e) {
641
+ se = function(e) {
643
642
  if (!this.listFeatures)
644
643
  return;
645
644
  const t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
646
645
  t && (this.input.focus(), this.focused = !0, e.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) && t === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += t, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
647
646
  };
648
- Fe = function(e) {
649
- c(this, r, he).call(this, e.target.value);
647
+ Ie = function(e) {
648
+ c(this, r, ce).call(this, e.target.value);
650
649
  };
651
- Oe = function(e) {
650
+ Le = function(e) {
652
651
  (!this.picked || this.picked.id !== e.id) && (this.picked = e, this.searchValue = e.place_name);
653
652
  };
654
- Se = function(e) {
653
+ Fe = function(e) {
655
654
  this.selectedItemIndex = e;
656
655
  };
656
+ Oe = function() {
657
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
658
+ };
659
+ Se = function() {
660
+ this.isFeatureListInteractedWith = !0;
661
+ };
657
662
  Te = function() {
658
- (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
663
+ setTimeout(() => {
664
+ this.isFeatureListInteractedWith = !1;
665
+ });
659
666
  };
660
667
  Ce = function() {
661
668
  this.searchValue = "", c(this, r, y).call(this, "queryclear"), this.picked = void 0, this.input.focus();
662
669
  };
663
670
  o.styles = L`
664
- ${ge(Ye)}
671
+ ${fe(Ye)}
665
672
  `;
666
673
  a([
667
674
  h({ attribute: !1 })
@@ -775,38 +782,41 @@ a([
775
782
  h({ type: String })
776
783
  ], o.prototype, "worldview", 2);
777
784
  a([
778
- Me("input")
785
+ Ue("input")
779
786
  ], o.prototype, "input", 2);
780
787
  a([
781
- b()
788
+ v()
782
789
  ], o.prototype, "searchValue", 2);
783
790
  a([
784
- b()
791
+ v()
785
792
  ], o.prototype, "listFeatures", 2);
786
793
  a([
787
- b()
794
+ v()
788
795
  ], o.prototype, "selectedItemIndex", 2);
789
796
  a([
790
- b()
797
+ v()
791
798
  ], o.prototype, "picked", 2);
792
799
  a([
793
- b()
800
+ v()
794
801
  ], o.prototype, "cachedFeatures", 2);
795
802
  a([
796
- b()
803
+ v()
797
804
  ], o.prototype, "lastSearchUrl", 2);
798
805
  a([
799
- b()
806
+ v()
800
807
  ], o.prototype, "error", 2);
801
808
  a([
802
- b()
809
+ v()
803
810
  ], o.prototype, "abortController", 2);
804
811
  a([
805
- b()
812
+ v()
806
813
  ], o.prototype, "focused", 2);
807
814
  a([
808
- b()
809
- ], o.prototype, "focusedDelayed", 2);
815
+ v()
816
+ ], o.prototype, "isFeatureListVisible", 2);
817
+ a([
818
+ v()
819
+ ], o.prototype, "isFeatureListInteractedWith", 2);
810
820
  o = a([
811
821
  O("maptiler-geocoder")
812
822
  ], o);
@@ -850,11 +860,11 @@ const it = [
850
860
  "worldview"
851
861
  ];
852
862
  export {
853
- J as MaptilerGeocodeClearIconElement,
854
- X as MaptilerGeocodeFailIconElement,
855
- Y as MaptilerGeocodeLoadingIconElement,
856
- ee as MaptilerGeocodeReverseGeocodingIconElement,
857
- te as MaptilerGeocodeSearchIconElement,
863
+ Q as MaptilerGeocodeClearIconElement,
864
+ H as MaptilerGeocodeFailIconElement,
865
+ J as MaptilerGeocodeLoadingIconElement,
866
+ X as MaptilerGeocodeReverseGeocodingIconElement,
867
+ Y as MaptilerGeocodeSearchIconElement,
858
868
  o as MaptilerGeocoderElement
859
869
  };
860
870
  //# sourceMappingURL=index.js.map