@maptiler/geocoding-control 3.0.0-rc.4 → 3.0.0-rc.6

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.
Files changed (37) hide show
  1. package/dist/index.js +307 -307
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.js +25 -25
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/leaflet.public.js +314 -313
  6. package/dist/leaflet.public.js.map +1 -1
  7. package/dist/leaflet.public.umd.js +28 -28
  8. package/dist/leaflet.public.umd.js.map +1 -1
  9. package/dist/maplibregl.js +296 -295
  10. package/dist/maplibregl.js.map +1 -1
  11. package/dist/maplibregl.umd.js +26 -26
  12. package/dist/maplibregl.umd.js.map +1 -1
  13. package/dist/maptilersdk.js +310 -309
  14. package/dist/maptilersdk.js.map +1 -1
  15. package/dist/maptilersdk.umd.js +29 -29
  16. package/dist/maptilersdk.umd.js.map +1 -1
  17. package/dist/openlayers.public.js +343 -341
  18. package/dist/openlayers.public.js.map +1 -1
  19. package/dist/openlayers.public.umd.js +41 -41
  20. package/dist/openlayers.public.umd.js.map +1 -1
  21. package/dist/src/controls/leaflet-events.d.ts +55 -26
  22. package/dist/src/controls/leaflet-options.d.ts +11 -1
  23. package/dist/src/controls/maplibregl-events.d.ts +54 -25
  24. package/dist/src/controls/maplibregl-options.d.ts +12 -2
  25. package/dist/src/controls/maptilersdk-control.d.ts +11 -1
  26. package/dist/src/controls/maptilersdk-events.d.ts +72 -2
  27. package/dist/src/controls/openlayers-control.d.ts +4 -4
  28. package/dist/src/controls/openlayers-events.d.ts +55 -25
  29. package/dist/src/controls/openlayers-options.d.ts +11 -1
  30. package/dist/src/geocoder/geocoder-events.d.ts +41 -27
  31. package/dist/src/geocoder/geocoder-options.d.ts +1 -3
  32. package/dist/src/leaflet.public.d.ts +1 -1
  33. package/dist/src/maplibregl.d.ts +1 -1
  34. package/dist/src/maptilersdk.d.ts +1 -1
  35. package/dist/src/openlayers.public.d.ts +1 -1
  36. package/dist/src/types.d.ts +1 -0
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { css as I, LitElement as L, svg as q, html as f, unsafeCSS as fe, nothing as Q } from "lit";
2
- import { customElement as F, property as h, state as b, query as Ue } from "lit/decorators.js";
3
- import { convert as Me } from "geo-coordinates-parser";
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";
4
4
  import { classMap as j } from "lit/directives/class-map.js";
5
- import { repeat as Pe } from "lit/directives/repeat.js";
5
+ import { repeat as Be } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
- import { styleMap as Be } from "lit/directives/style-map.js";
8
- var Ee = Object.getOwnPropertyDescriptor, Ge = (e, t, i, n) => {
9
- for (var s = n > 1 ? void 0 : n ? Ee(t, i) : t, r = e.length - 1, p; r >= 0; r--)
10
- (p = e[r]) && (s = p(s) || s);
7
+ import { styleMap as Ee } from "lit/directives/style-map.js";
8
+ var Ge = Object.getOwnPropertyDescriptor, De = (e, t, i, n) => {
9
+ for (var s = n > 1 ? void 0 : n ? Ge(t, i) : t, p = e.length - 1, l; p >= 0; p--)
10
+ (l = e[p]) && (s = l(s) || s);
11
11
  return s;
12
12
  };
13
- let H = class extends L {
13
+ let J = class extends F {
14
14
  render() {
15
15
  return q`
16
16
  <svg viewBox="0 0 14 14" width="13" height="13">
@@ -21,21 +21,21 @@ let H = class extends L {
21
21
  `;
22
22
  }
23
23
  };
24
- H.styles = I`
24
+ J.styles = L`
25
25
  svg {
26
26
  display: block;
27
27
  fill: var(--color-icon-button);
28
28
  }
29
29
  `;
30
- H = Ge([
31
- F("maptiler-geocode-clear-icon")
32
- ], H);
33
- var De = Object.getOwnPropertyDescriptor, je = (e, t, i, n) => {
34
- for (var s = n > 1 ? void 0 : n ? De(t, i) : t, r = e.length - 1, p; r >= 0; r--)
35
- (p = e[r]) && (s = p(s) || s);
30
+ J = De([
31
+ O("maptiler-geocode-clear-icon")
32
+ ], J);
33
+ var je = Object.getOwnPropertyDescriptor, Ae = (e, t, i, n) => {
34
+ for (var s = n > 1 ? void 0 : n ? je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
35
+ (l = e[p]) && (s = l(s) || s);
36
36
  return s;
37
37
  };
38
- let J = class extends L {
38
+ let X = class extends F {
39
39
  render() {
40
40
  return q`
41
41
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -46,21 +46,21 @@ let J = class extends L {
46
46
  `;
47
47
  }
48
48
  };
49
- J.styles = I`
49
+ X.styles = L`
50
50
  svg {
51
51
  display: block;
52
52
  fill: #e15042;
53
53
  }
54
54
  `;
55
- J = je([
56
- F("maptiler-geocode-fail-icon")
57
- ], J);
58
- var Ae = Object.getOwnPropertyDescriptor, Re = (e, t, i, n) => {
59
- for (var s = n > 1 ? void 0 : n ? Ae(t, i) : t, r = e.length - 1, p; r >= 0; r--)
60
- (p = e[r]) && (s = p(s) || s);
55
+ X = Ae([
56
+ O("maptiler-geocode-fail-icon")
57
+ ], X);
58
+ var Re = Object.getOwnPropertyDescriptor, We = (e, t, i, n) => {
59
+ for (var s = n > 1 ? void 0 : n ? Re(t, i) : t, p = e.length - 1, l; p >= 0; p--)
60
+ (l = e[p]) && (s = l(s) || s);
61
61
  return s;
62
62
  };
63
- let X = class extends L {
63
+ let Y = class extends F {
64
64
  render() {
65
65
  return f`
66
66
  <div>
@@ -72,7 +72,7 @@ let X = class extends L {
72
72
  `;
73
73
  }
74
74
  };
75
- X.styles = I`
75
+ Y.styles = L`
76
76
  div {
77
77
  position: absolute;
78
78
  left: 50%;
@@ -99,15 +99,15 @@ X.styles = I`
99
99
  }
100
100
  }
101
101
  `;
102
- X = Re([
103
- F("maptiler-geocode-loading-icon")
104
- ], X);
105
- var We = Object.getOwnPropertyDescriptor, Ve = (e, t, i, n) => {
106
- for (var s = n > 1 ? void 0 : n ? We(t, i) : t, r = e.length - 1, p; r >= 0; r--)
107
- (p = e[r]) && (s = p(s) || s);
102
+ Y = We([
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--)
107
+ (l = e[p]) && (s = l(s) || s);
108
108
  return s;
109
109
  };
110
- let Y = class extends L {
110
+ let ee = class extends F {
111
111
  render() {
112
112
  return q`
113
113
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
@@ -118,21 +118,21 @@ let Y = class extends L {
118
118
  `;
119
119
  }
120
120
  };
121
- Y.styles = I`
121
+ ee.styles = L`
122
122
  svg {
123
123
  display: block;
124
124
  fill: var(--color-icon-button);
125
125
  }
126
126
  `;
127
- Y = Ve([
128
- F("maptiler-geocode-reverse-geocoding-icon")
129
- ], Y);
130
- var ze = Object.getOwnPropertyDescriptor, qe = (e, t, i, n) => {
131
- for (var s = n > 1 ? void 0 : n ? ze(t, i) : t, r = e.length - 1, p; r >= 0; r--)
132
- (p = e[r]) && (s = p(s) || s);
127
+ ee = ze([
128
+ O("maptiler-geocode-reverse-geocoding-icon")
129
+ ], ee);
130
+ var qe = Object.getOwnPropertyDescriptor, Ne = (e, t, i, n) => {
131
+ for (var s = n > 1 ? void 0 : n ? qe(t, i) : t, p = e.length - 1, l; p >= 0; p--)
132
+ (l = e[p]) && (s = l(s) || s);
133
133
  return s;
134
134
  };
135
- let ee = class extends L {
135
+ let te = class extends F {
136
136
  render() {
137
137
  return q`
138
138
  <svg
@@ -147,7 +147,7 @@ let ee = class extends L {
147
147
  `;
148
148
  }
149
149
  };
150
- ee.styles = I`
150
+ te.styles = L`
151
151
  circle {
152
152
  stroke-width: 1.875;
153
153
  fill: none;
@@ -163,15 +163,15 @@ ee.styles = I`
163
163
  stroke: var(--color-icon-button);
164
164
  }
165
165
  `;
166
- ee = qe([
167
- F("maptiler-geocode-search-icon")
168
- ], ee);
169
- function Ne(e, t, i) {
170
- const n = t[1], s = t[0], r = n - s;
171
- return e === n && i ? e : ((e - s) % r + r) % r + s;
166
+ te = Ne([
167
+ O("maptiler-geocode-search-icon")
168
+ ], te);
169
+ function Ke(e, t, i) {
170
+ const n = t[1], s = t[0], p = n - s;
171
+ return e === n && i ? e : ((e - s) % p + p) % p + s;
172
172
  }
173
173
  let P;
174
- async function Ke(e, t, i) {
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")
@@ -183,15 +183,15 @@ async function Ke(e, t, i) {
183
183
  } else {
184
184
  let s;
185
185
  try {
186
- return s = await new Promise((r, p) => {
186
+ return s = await new Promise((p, l) => {
187
187
  i.signal.addEventListener("abort", () => {
188
- p(Error("aborted"));
188
+ l(Error("aborted"));
189
189
  }), navigator.geolocation.getCurrentPosition(
190
- (m) => {
191
- r([m.coords.longitude, m.coords.latitude].map((U) => U.toFixed(6)).join(","));
190
+ (_) => {
191
+ p([_.coords.longitude, _.coords.latitude].map((v) => v.toFixed(6)).join(","));
192
192
  },
193
- (m) => {
194
- p(m);
193
+ (_) => {
194
+ l(_);
195
195
  },
196
196
  n
197
197
  );
@@ -212,21 +212,21 @@ async function Ke(e, t, i) {
212
212
  return e[1].toFixed(6) + "," + e[2].toFixed(6);
213
213
  }
214
214
  }
215
- const Ze = ".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 Qe = Object.defineProperty, He = Object.getOwnPropertyDescriptor, ge = (e) => {
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) => {
217
217
  throw TypeError(e);
218
- }, _ = (e, t, i, n) => {
219
- for (var s = n > 1 ? void 0 : n ? He(t, i) : t, r = e.length - 1, p; r >= 0; r--)
220
- (p = e[r]) && (s = (n ? p(t, i, s) : p(s)) || s);
221
- return n && s && Qe(t, i, s), s;
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)), Je = (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, W, B, g, ye, ve, re, te;
223
- const xe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, be = xe ? "@2x" : "", S = xe ? 2 : 1;
224
- let k, we, w = class extends L {
218
+ }, $ = (e, t, i, n) => {
219
+ for (var s = n > 1 ? void 0 : n ? Je(t, i) : t, p = e.length - 1, l; p >= 0; p--)
220
+ (l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
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 {
225
225
  constructor() {
226
- super(...arguments), Je(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
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, C(this, d, re).call(this));
229
+ e.has("feature") && u(this, d, W) && (this.index = u(this, d, W).length, U(this, d, oe).call(this));
230
230
  }
231
231
  render() {
232
232
  return f`
@@ -238,25 +238,25 @@ let k, we, w = class extends L {
238
238
  class=${this.itemStyle}
239
239
  @click=${() => this.dispatchEvent(new CustomEvent("select"))}
240
240
  >
241
- ${k && this.spriteIcon ? f`
241
+ ${I && this.spriteIcon ? f`
242
242
  <div
243
243
  class="sprite-icon"
244
- style=${Be({
245
- width: `${this.spriteIcon.width / S}px`,
246
- height: `${this.spriteIcon.height / S}px`,
247
- backgroundImage: `url(${this.iconsBaseUrl}sprite${be}.png)`,
248
- backgroundPosition: `-${this.spriteIcon.x / S}px -${this.spriteIcon.y / S}px`,
249
- backgroundSize: `${k.width / S}px ${k.height / S}px`
244
+ style=${Ee({
245
+ width: `${this.spriteIcon.width / T}px`,
246
+ height: `${this.spriteIcon.height / T}px`,
247
+ backgroundImage: `url(${this.iconsBaseUrl}sprite${we}.png)`,
248
+ backgroundPosition: `-${this.spriteIcon.x / T}px -${this.spriteIcon.y / T}px`,
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=${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, 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=${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)} /> `}
254
254
 
255
255
  <span class="texts">
256
256
  <span>
257
257
  <span class="primary"> ${u(this, d, B) ? 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> ` : Q}
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}
260
260
  </span>
261
261
 
262
262
  <span class="line2"> ${u(this, d, B) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
@@ -275,72 +275,72 @@ B = function() {
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
- ye = function() {
279
- we ??= fetch(`${this.iconsBaseUrl}sprite${be}.json`).then((e) => e.json()).then((e) => {
280
- k = e;
278
+ ve = function() {
279
+ _e ??= fetch(`${this.iconsBaseUrl}sprite${we}.json`).then((e) => e.json()).then((e) => {
280
+ I = e;
281
281
  }).catch(() => {
282
- k = null;
282
+ I = null;
283
283
  });
284
284
  };
285
- ve = function() {
286
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), C(this, d, re).call(this);
285
+ xe = function() {
286
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), U(this, d, oe).call(this);
287
287
  };
288
- re = function() {
289
- k !== void 0 ? C(this, d, te).call(this) : (C(this, d, ye).call(this), we?.then(() => {
290
- C(this, d, te).call(this);
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);
291
291
  }));
292
292
  };
293
- te = function() {
293
+ ie = function() {
294
294
  do {
295
- if (this.index--, this.category = u(this, d, W)?.[this.index], this.spriteIcon = this.category ? k?.icons[this.category] : void 0, this.spriteIcon)
295
+ if (this.index--, this.category = u(this, d, W)?.[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
- w.styles = I`
301
- ${fe(Ze)}
300
+ w.styles = L`
301
+ ${ge(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
- _([
318
+ $([
319
319
  b()
320
320
  ], w.prototype, "category", 2);
321
- _([
321
+ $([
322
322
  b()
323
323
  ], w.prototype, "imageUrl", 2);
324
- _([
324
+ $([
325
325
  b()
326
326
  ], w.prototype, "spriteIcon", 2);
327
- _([
327
+ $([
328
328
  b()
329
329
  ], w.prototype, "index", 2);
330
- w = _([
331
- F("maptiler-geocoder-feature-item")
330
+ w = $([
331
+ O("maptiler-geocoder-feature-item")
332
332
  ], w);
333
- const Xe = "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}";
334
- var Ye = Object.defineProperty, et = Object.getOwnPropertyDescriptor, _e = (e) => {
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}";
334
+ var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, $e = (e) => {
335
335
  throw TypeError(e);
336
- }, l = (e, t, i, n) => {
337
- for (var s = n > 1 ? void 0 : n ? et(t, i) : t, r = e.length - 1, p; r >= 0; r--)
338
- (p = e[r]) && (s = (n ? p(t, i, s) : p(s)) || s);
339
- return n && s && Ye(t, i, s), s;
340
- }, oe = (e, t, i) => t.has(e) || _e("Cannot " + i), x = (e, t, i) => (oe(e, t, "read from private field"), i ? i.call(e) : t.get(e)), T = (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) => (oe(e, t, "write to private field"), t.set(e, i), i), c = (e, t, i) => (oe(e, t, "access private method"), i), V, R, E, ie, G, o, z, $e, ke, ae, v, le, N, ne, ce, $, he, K, Ie, se, Le, Fe, Oe, Se, Te;
341
- let a = class extends L {
336
+ }, a = (e, t, i, n) => {
337
+ for (var s = n > 1 ? void 0 : n ? tt(t, i) : t, p = e.length - 1, l; p >= 0; p--)
338
+ (l = e[p]) && (s = (n ? l(t, i, s) : l(s)) || s);
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;
341
+ let o = class extends F {
342
342
  constructor() {
343
- super(...arguments), T(this, o), 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, T(this, V, !1), T(this, R, !1), T(this, E), T(this, ie, /* @__PURE__ */ new Set()), T(this, G);
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);
344
344
  }
345
345
  firstUpdated() {
346
346
  A(this, V, !0);
@@ -353,7 +353,7 @@ let a = class extends L {
353
353
  setOptions(e) {
354
354
  const t = { ...e };
355
355
  for (const i of Object.keys(t))
356
- tt.includes(i) || delete t[i];
356
+ it.includes(i) || delete t[i];
357
357
  Object.assign(this, t);
358
358
  }
359
359
  /**
@@ -362,7 +362,7 @@ let a = class extends L {
362
362
  * @param value text to set
363
363
  */
364
364
  setQuery(e) {
365
- c(this, o, ce).call(this, e), c(this, o, ne).call(this);
365
+ c(this, r, he).call(this, e, { external: !0 }), c(this, r, ce).call(this);
366
366
  }
367
367
  /**
368
368
  * Set the content of search input box and immediately submit it.
@@ -370,13 +370,13 @@ let a = class extends L {
370
370
  * @param value text to set and submit
371
371
  */
372
372
  submitQuery(e) {
373
- c(this, o, he).call(this, e);
373
+ c(this, r, pe).call(this, e);
374
374
  }
375
375
  /**
376
376
  * Clear search result list.
377
377
  */
378
378
  clearList() {
379
- c(this, o, $).call(this), this.picked = void 0, this.selectedItemIndex = -1;
379
+ c(this, r, k).call(this), this.picked = void 0, this.selectedItemIndex = -1;
380
380
  }
381
381
  /**
382
382
  * Focus the search input box.
@@ -404,23 +404,23 @@ let a = class extends L {
404
404
  }
405
405
  /** @internal */
406
406
  handleMapClick(e) {
407
- this.reverseActive && c(this, o, Ie).call(this, e);
407
+ this.reverseActive && c(this, r, Le).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, o, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((t) => e.has(t)) && x(this, o, ae) && (c(this, o, $).call(this), this.error = void 0), ["focused"].some((t) => e.has(t)) && setTimeout(() => {
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
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, o, v).call(this, "select", { feature: x(this, o, 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, o, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
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(
413
413
  () => {
414
- c(this, o, v).call(this, "pick", { feature: this.picked });
414
+ c(this, r, y).call(this, "pick", { feature: this.picked });
415
415
  },
416
416
  (t) => {
417
- t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this, o, v).call(this, "pick", { feature: this.picked }));
417
+ t && typeof t == "object" && "name" in t && t.name === "AbortError" || (this.error = t, c(this, r, y).call(this, "pick", { feature: this.picked }));
418
418
  }
419
- ), ["listFeatures", "focusedDelayed"].some((t) => e.has(t)) && (x(this, o, $e) ? (c(this, o, v).call(this, "featuresshow"), A(this, R, !0)) : x(this, R) && c(this, o, v).call(this, "featureshide")), ["reverseActive"].some((t) => e.has(t)) && c(this, o, v).call(this, "reversetoggle", { reverse: this.reverseActive });
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 });
420
420
  }
421
421
  render() {
422
422
  return f`
423
- <form @submit=${c(this, o, le)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
423
+ <form @submit=${c(this, r, ne)} class=${j({ "can-collapse": this.collapsed && this.searchValue === "" })}>
424
424
  <div class="input-group">
425
425
  <button
426
426
  class="search-button"
@@ -437,16 +437,16 @@ let a = class extends L {
437
437
  @focus=${() => this.focused = !0}
438
438
  @blur=${() => this.focused = !1}
439
439
  @click=${() => this.focused = !0}
440
- @keydown=${c(this, o, se)}
441
- @input=${c(this, o, Le)}
440
+ @keydown=${c(this, r, re)}
441
+ @input=${c(this, r, Fe)}
442
442
  @change=${() => this.picked = void 0}
443
443
  placeholder=${this.placeholder ?? "Search"}
444
444
  aria-label=${this.placeholder ?? "Search"}
445
445
  />
446
446
 
447
447
  <div class="clear-button-container ${j({ displayable: this.searchValue !== "" })}">
448
- ${x(this, o, ke) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
449
- <button type="button" @click=${c(this, o, Te)} title=${this.clearButtonTitle ?? "clear"}>
448
+ ${x(this, r, Ie) ? f`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : f`
449
+ <button type="button" @click=${c(this, r, Ce)} title=${this.clearButtonTitle ?? "clear"}>
450
450
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
451
451
  </button>
452
452
  `}
@@ -461,7 +461,7 @@ let a = class extends L {
461
461
  >
462
462
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
463
463
  </button>
464
- ` : Q}
464
+ ` : H}
465
465
 
466
466
  <!-- <slot /> -->
467
467
  </div>
@@ -476,7 +476,7 @@ let a = class extends L {
476
476
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
477
477
  </button>
478
478
  </div>
479
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? Q : this.listFeatures.length === 0 ? f`
479
+ ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? f`
480
480
  <div class="no-results">
481
481
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
482
482
 
@@ -485,8 +485,8 @@ let a = class extends L {
485
485
  </div>
486
486
  </div>
487
487
  ` : f`
488
- <ul class="options ${j({ "open-on-top": this.openListOnTop })}" @mouseleave=${c(this, o, Se)} @keydown=${c(this, o, se)} role="listbox">
489
- ${Pe(
488
+ <ul class="options ${j({ "open-on-top": this.openListOnTop })}" @mouseleave=${c(this, r, Te)} @keydown=${c(this, r, re)} role="listbox">
489
+ ${Be(
490
490
  this.listFeatures,
491
491
  (e) => e.id + (e.address ? "," + e.address : ""),
492
492
  (e, t) => f`
@@ -495,13 +495,13 @@ let a = class extends L {
495
495
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
496
496
  itemStyle=${this.selectedItemIndex === t ? "selected" : this.picked?.id === e.id ? "picked" : "default"}
497
497
  @mouseenter=${() => {
498
- c(this, o, Oe).call(this, t);
498
+ c(this, r, Se).call(this, t);
499
499
  }}
500
500
  @select=${() => {
501
- c(this, o, Fe).call(this, e);
501
+ c(this, r, Oe).call(this, e);
502
502
  }}
503
- .missingIconsCache=${x(this, ie)}
504
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.4/icons/"}
503
+ .missingIconsCache=${x(this, se)}
504
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.6/icons/"}
505
505
  >
506
506
  ${e.place_name}
507
507
  </maptiler-geocoder-feature-item>
@@ -516,22 +516,22 @@ let a = class extends L {
516
516
  V = /* @__PURE__ */ new WeakMap();
517
517
  R = /* @__PURE__ */ new WeakMap();
518
518
  E = /* @__PURE__ */ new WeakMap();
519
- ie = /* @__PURE__ */ new WeakMap();
519
+ se = /* @__PURE__ */ new WeakMap();
520
520
  G = /* @__PURE__ */ new WeakMap();
521
- o = /* @__PURE__ */ new WeakSet();
521
+ r = /* @__PURE__ */ new WeakSet();
522
522
  z = function() {
523
523
  return this.listFeatures?.[this.selectedItemIndex];
524
524
  };
525
- $e = function() {
525
+ ke = function() {
526
526
  return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
527
527
  };
528
- ke = function() {
528
+ Ie = function() {
529
529
  return this.abortController !== void 0;
530
530
  };
531
- ae = function() {
531
+ le = function() {
532
532
  return this.searchValue.length < (this.minLength ?? 2);
533
533
  };
534
- v = function(e, ...[t]) {
534
+ y = function(e, ...[t]) {
535
535
  x(this, V) && this.dispatchEvent(
536
536
  new CustomEvent(e, {
537
537
  bubbles: !0,
@@ -540,277 +540,277 @@ v = function(e, ...[t]) {
540
540
  })
541
541
  );
542
542
  };
543
- le = 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, o, K).call(this, this.searchValue, { exact: !0 }).then(() => {
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(() => {
545
545
  this.picked = void 0;
546
546
  }).catch((t) => this.error = t);
547
547
  };
548
548
  N = function(e) {
549
549
  try {
550
- return Me(e, 6);
550
+ return Pe(e, 6);
551
551
  } catch {
552
552
  return !1;
553
553
  }
554
554
  };
555
- ne = function() {
555
+ ce = function() {
556
556
  setTimeout(() => {
557
557
  this.input.focus(), this.focused = !0, this.input.select();
558
558
  });
559
559
  };
560
- ce = function(e) {
561
- if (this.searchValue = e, c(this, o, v).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, o, N).call(this, e) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
562
- if (clearTimeout(x(this, E)), x(this, o, ae))
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))
563
563
  return;
564
- const t = this.searchValue;
564
+ const i = this.searchValue;
565
565
  A(this, E, window.setTimeout(() => {
566
- c(this, o, K).call(this, t).catch((i) => this.error = i);
566
+ c(this, r, K).call(this, i, { external: t }).catch((n) => this.error = n);
567
567
  }, this.debounceSearch ?? 200));
568
568
  } else
569
- c(this, o, $).call(this);
569
+ c(this, r, k).call(this);
570
570
  };
571
- $ = function() {
572
- this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, o, v).call(this, "featuresclear"));
571
+ k = function() {
572
+ this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, r, y).call(this, "featuresclear"));
573
573
  };
574
- he = function(e) {
575
- this.searchValue = e, c(this, o, v).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, o, N).call(this, e) }), this.selectedItemIndex = -1, c(this, o, le).call(this);
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);
576
576
  };
577
- K = async function(e, { byId: t = !1, exact: i = !1 } = {}) {
577
+ K = async function(e, { byId: t = !1, exact: i = !1, external: n = !1 } = {}) {
578
578
  this.error = void 0, this.abortController?.abort();
579
- const n = new AbortController();
580
- this.abortController = n;
579
+ const s = new AbortController();
580
+ this.abortController = s;
581
581
  try {
582
- const s = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = c(this, o, N).call(this, e), p = new URL(s + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : e) + ".json"), m = p.searchParams;
583
- this.language !== void 0 && m.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
584
- const [U] = x(this, G) ?? [void 0];
585
- let O = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
586
- (y) => typeof y == "string" ? y : U === void 0 || (y[0] ?? 0) <= U && U < (y[1] ?? 1 / 0) ? y[2] : void 0
587
- ).filter((y) => y !== void 0);
588
- O && (O = [...new Set(O)], m.set("types", O.join(",")));
589
- const pe = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
590
- if (pe && m.set("excludeTypes", String(pe)), this.bbox && m.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && m.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && m.set("worldview", this.worldview), !t && !r) {
591
- const y = this.proximity ?? [{ type: "server-geolocation" }], ue = await Ke(x(this, G), y, n);
592
- ue && m.set("proximity", ue), (i || this.showResultsWhileTyping === !1) && m.set("autocomplete", "false"), m.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
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];
585
+ 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
587
+ ).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));
593
593
  }
594
- const de = this.limit ?? 5, Z = this.reverseGeocodingLimit ?? de;
595
- Z > 1 && O?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (Z === 1 || this.exhaustiveReverseGeocoding || O?.length === 1) && m.set("limit", String(Z)) : m.set("limit", String(de)), this.apiKey && m.set("key", this.apiKey), this.adjustUrl?.(p);
596
- const Ce = p.searchParams.get("types") === "" && p.searchParams.get("excludeTypes") !== "true", D = p.toString();
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
597
  if (D === this.lastSearchUrl) {
598
- t ? (this.clearListOnPick && c(this, o, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, o, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, o, z)?.id && (this.selectedItemIndex = -1));
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));
599
599
  return;
600
600
  }
601
- c(this, o, v).call(this, "request", { urlObj: p }), this.lastSearchUrl = D;
601
+ c(this, r, y).call(this, "request", { urlObj: _ }), this.lastSearchUrl = D;
602
602
  let M;
603
- if (Ce)
603
+ if (Ue)
604
604
  M = { type: "FeatureCollection", features: [] };
605
605
  else {
606
- const y = await fetch(D, {
607
- signal: n.signal,
606
+ const m = await fetch(D, {
607
+ signal: s.signal,
608
608
  ...this.fetchParameters
609
609
  });
610
- if (!y.ok)
611
- throw new Error(await y.text());
612
- M = await y.json();
610
+ if (!m.ok)
611
+ throw new Error(await m.text());
612
+ M = await m.json();
613
613
  }
614
- c(this, o, v).call(this, "response", { url: D, featureCollection: M }), t ? (this.clearListOnPick && c(this, o, $).call(this), this.picked = M.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = M.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
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({
615
615
  type: "Feature",
616
616
  properties: {},
617
617
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
618
- id: `reverse_${r.decimalLongitude}_${r.decimalLatitude}`,
619
- text: `${r.decimalLatitude}, ${r.decimalLongitude}`,
620
- place_name: r.toCoordinateFormat("DMS"),
618
+ id: `reverse_${l.decimalLongitude}_${l.decimalLatitude}`,
619
+ text: `${l.decimalLatitude}, ${l.decimalLongitude}`,
620
+ place_name: l.toCoordinateFormat("DMS"),
621
621
  /* eslint-enable @typescript-eslint/restrict-template-expressions */
622
622
  place_type: ["reverse"],
623
623
  place_type_name: ["reverse"],
624
- center: [r.decimalLongitude, r.decimalLatitude],
625
- bbox: [r.decimalLongitude, r.decimalLatitude, r.decimalLongitude, r.decimalLatitude],
624
+ center: [l.decimalLongitude, l.decimalLatitude],
625
+ bbox: [l.decimalLongitude, l.decimalLatitude, l.decimalLongitude, l.decimalLatitude],
626
626
  geometry: {
627
627
  type: "Point",
628
- coordinates: [r.decimalLongitude, r.decimalLatitude]
628
+ coordinates: [l.decimalLongitude, l.decimalLatitude]
629
629
  }
630
- }), c(this, o, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, o, z)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
631
- } catch (s) {
632
- if (s && typeof s == "object" && "name" in s && s.name === "AbortError")
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());
631
+ } catch (p) {
632
+ if (p && typeof p == "object" && "name" in p && p.name === "AbortError")
633
633
  return;
634
- throw s;
634
+ throw p;
635
635
  } finally {
636
- n === this.abortController && (this.abortController = void 0);
636
+ s === this.abortController && (this.abortController = void 0);
637
637
  }
638
638
  };
639
- Ie = function(e) {
640
- this.reverseActive = this.enableReverse === "always", c(this, o, $).call(this), this.picked = void 0, c(this, o, he).call(this, `${e[1].toFixed(6)}, ${Ne(e[0], [-180, 180], !0).toFixed(6)}`), c(this, o, ne).call(this);
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);
641
641
  };
642
- se = function(e) {
642
+ re = function(e) {
643
643
  if (!this.listFeatures)
644
644
  return;
645
645
  const t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
646
646
  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
647
  };
648
- Le = function(e) {
649
- c(this, o, ce).call(this, e.target.value);
650
- };
651
648
  Fe = function(e) {
652
- (!this.picked || this.picked.id !== e.id) && (this.picked = e, this.searchValue = e.place_name);
649
+ c(this, r, he).call(this, e.target.value);
653
650
  };
654
651
  Oe = function(e) {
652
+ (!this.picked || this.picked.id !== e.id) && (this.picked = e, this.searchValue = e.place_name);
653
+ };
654
+ Se = function(e) {
655
655
  this.selectedItemIndex = e;
656
656
  };
657
- Se = function() {
657
+ Te = function() {
658
658
  (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
659
659
  };
660
- Te = function() {
661
- this.searchValue = "", c(this, o, v).call(this, "queryclear"), this.picked = void 0, this.input.focus();
660
+ Ce = function() {
661
+ this.searchValue = "", c(this, r, y).call(this, "queryclear"), this.picked = void 0, this.input.focus();
662
662
  };
663
- a.styles = I`
664
- ${fe(Xe)}
663
+ o.styles = L`
664
+ ${ge(Ye)}
665
665
  `;
666
- l([
666
+ a([
667
667
  h({ attribute: !1 })
668
- ], a.prototype, "adjustUrl", 2);
669
- l([
668
+ ], o.prototype, "adjustUrl", 2);
669
+ a([
670
670
  h({ type: String })
671
- ], a.prototype, "apiKey", 2);
672
- l([
671
+ ], o.prototype, "apiKey", 2);
672
+ a([
673
673
  h({ type: String })
674
- ], a.prototype, "apiUrl", 2);
675
- l([
674
+ ], o.prototype, "apiUrl", 2);
675
+ a([
676
676
  h({ type: Array })
677
- ], a.prototype, "bbox", 2);
678
- l([
677
+ ], o.prototype, "bbox", 2);
678
+ a([
679
679
  h({ type: String })
680
- ], a.prototype, "clearButtonTitle", 2);
681
- l([
680
+ ], o.prototype, "clearButtonTitle", 2);
681
+ a([
682
682
  h({ type: Boolean })
683
- ], a.prototype, "clearListOnPick", 2);
684
- l([
683
+ ], o.prototype, "clearListOnPick", 2);
684
+ a([
685
685
  h({ type: Boolean })
686
- ], a.prototype, "clearOnBlur", 2);
687
- l([
686
+ ], o.prototype, "clearOnBlur", 2);
687
+ a([
688
688
  h({ type: Boolean })
689
- ], a.prototype, "collapsed", 2);
690
- l([
689
+ ], o.prototype, "collapsed", 2);
690
+ a([
691
691
  h({ attribute: !1 })
692
- ], a.prototype, "country", 2);
693
- l([
692
+ ], o.prototype, "country", 2);
693
+ a([
694
694
  h({ type: Number })
695
- ], a.prototype, "debounceSearch", 2);
696
- l([
695
+ ], o.prototype, "debounceSearch", 2);
696
+ a([
697
697
  h({ type: String })
698
- ], a.prototype, "enableReverse", 2);
699
- l([
698
+ ], o.prototype, "enableReverse", 2);
699
+ a([
700
700
  h({ type: String })
701
- ], a.prototype, "errorMessage", 2);
702
- l([
701
+ ], o.prototype, "errorMessage", 2);
702
+ a([
703
703
  h({ type: Boolean })
704
- ], a.prototype, "excludeTypes", 2);
705
- l([
704
+ ], o.prototype, "excludeTypes", 2);
705
+ a([
706
706
  h({ type: Boolean })
707
- ], a.prototype, "exhaustiveReverseGeocoding", 2);
708
- l([
707
+ ], o.prototype, "exhaustiveReverseGeocoding", 2);
708
+ a([
709
709
  h({ type: Boolean })
710
- ], a.prototype, "fetchFullGeometryOnPick", 2);
711
- l([
710
+ ], o.prototype, "fetchFullGeometryOnPick", 2);
711
+ a([
712
712
  h({ type: Object })
713
- ], a.prototype, "fetchParameters", 2);
714
- l([
713
+ ], o.prototype, "fetchParameters", 2);
714
+ a([
715
715
  h({ attribute: !1 })
716
- ], a.prototype, "filter", 2);
717
- l([
716
+ ], o.prototype, "filter", 2);
717
+ a([
718
718
  h({ type: Object })
719
- ], a.prototype, "fuzzyMatch", 2);
720
- l([
719
+ ], o.prototype, "fuzzyMatch", 2);
720
+ a([
721
721
  h({ type: String })
722
- ], a.prototype, "iconsBaseUrl", 2);
723
- l([
722
+ ], o.prototype, "iconsBaseUrl", 2);
723
+ a([
724
724
  h({ type: Boolean })
725
- ], a.prototype, "keepListOpen", 2);
726
- l([
725
+ ], o.prototype, "keepListOpen", 2);
726
+ a([
727
727
  h({ attribute: !1 })
728
- ], a.prototype, "language", 2);
729
- l([
728
+ ], o.prototype, "language", 2);
729
+ a([
730
730
  h({ type: Number })
731
- ], a.prototype, "limit", 2);
732
- l([
731
+ ], o.prototype, "limit", 2);
732
+ a([
733
733
  h({ type: Number })
734
- ], a.prototype, "minLength", 2);
735
- l([
734
+ ], o.prototype, "minLength", 2);
735
+ a([
736
736
  h({ type: String })
737
- ], a.prototype, "noResultsMessage", 2);
738
- l([
737
+ ], o.prototype, "noResultsMessage", 2);
738
+ a([
739
739
  h({ type: Boolean })
740
- ], a.prototype, "openListOnTop", 2);
741
- l([
740
+ ], o.prototype, "openListOnTop", 2);
741
+ a([
742
742
  h({ type: String })
743
- ], a.prototype, "placeholder", 2);
744
- l([
743
+ ], o.prototype, "placeholder", 2);
744
+ a([
745
745
  h({ type: Array })
746
- ], a.prototype, "proximity", 2);
747
- l([
746
+ ], o.prototype, "proximity", 2);
747
+ a([
748
748
  h({ type: Boolean })
749
- ], a.prototype, "reverseActive", 2);
750
- l([
749
+ ], o.prototype, "reverseActive", 2);
750
+ a([
751
751
  h({ type: String })
752
- ], a.prototype, "reverseButtonTitle", 2);
753
- l([
752
+ ], o.prototype, "reverseButtonTitle", 2);
753
+ a([
754
754
  h({ type: Object })
755
- ], a.prototype, "reverseGeocodingExcludeTypes", 2);
756
- l([
755
+ ], o.prototype, "reverseGeocodingExcludeTypes", 2);
756
+ a([
757
757
  h({ type: Number })
758
- ], a.prototype, "reverseGeocodingLimit", 2);
759
- l([
758
+ ], o.prototype, "reverseGeocodingLimit", 2);
759
+ a([
760
760
  h({ type: Array })
761
- ], a.prototype, "reverseGeocodingTypes", 2);
762
- l([
761
+ ], o.prototype, "reverseGeocodingTypes", 2);
762
+ a([
763
763
  h({ type: Object })
764
- ], a.prototype, "selectFirst", 2);
765
- l([
764
+ ], o.prototype, "selectFirst", 2);
765
+ a([
766
766
  h({ type: String })
767
- ], a.prototype, "showPlaceType", 2);
768
- l([
767
+ ], o.prototype, "showPlaceType", 2);
768
+ a([
769
769
  h({ type: Object })
770
- ], a.prototype, "showResultsWhileTyping", 2);
771
- l([
770
+ ], o.prototype, "showResultsWhileTyping", 2);
771
+ a([
772
772
  h({ type: Array })
773
- ], a.prototype, "types", 2);
774
- l([
773
+ ], o.prototype, "types", 2);
774
+ a([
775
775
  h({ type: String })
776
- ], a.prototype, "worldview", 2);
777
- l([
778
- Ue("input")
779
- ], a.prototype, "input", 2);
780
- l([
776
+ ], o.prototype, "worldview", 2);
777
+ a([
778
+ Me("input")
779
+ ], o.prototype, "input", 2);
780
+ a([
781
781
  b()
782
- ], a.prototype, "searchValue", 2);
783
- l([
782
+ ], o.prototype, "searchValue", 2);
783
+ a([
784
784
  b()
785
- ], a.prototype, "listFeatures", 2);
786
- l([
785
+ ], o.prototype, "listFeatures", 2);
786
+ a([
787
787
  b()
788
- ], a.prototype, "selectedItemIndex", 2);
789
- l([
788
+ ], o.prototype, "selectedItemIndex", 2);
789
+ a([
790
790
  b()
791
- ], a.prototype, "picked", 2);
792
- l([
791
+ ], o.prototype, "picked", 2);
792
+ a([
793
793
  b()
794
- ], a.prototype, "cachedFeatures", 2);
795
- l([
794
+ ], o.prototype, "cachedFeatures", 2);
795
+ a([
796
796
  b()
797
- ], a.prototype, "lastSearchUrl", 2);
798
- l([
797
+ ], o.prototype, "lastSearchUrl", 2);
798
+ a([
799
799
  b()
800
- ], a.prototype, "error", 2);
801
- l([
800
+ ], o.prototype, "error", 2);
801
+ a([
802
802
  b()
803
- ], a.prototype, "abortController", 2);
804
- l([
803
+ ], o.prototype, "abortController", 2);
804
+ a([
805
805
  b()
806
- ], a.prototype, "focused", 2);
807
- l([
806
+ ], o.prototype, "focused", 2);
807
+ a([
808
808
  b()
809
- ], a.prototype, "focusedDelayed", 2);
810
- a = l([
811
- F("maptiler-geocoder")
812
- ], a);
813
- const tt = [
809
+ ], o.prototype, "focusedDelayed", 2);
810
+ o = a([
811
+ O("maptiler-geocoder")
812
+ ], o);
813
+ const it = [
814
814
  "adjustUrl",
815
815
  "apiKey",
816
816
  "apiUrl",
@@ -850,11 +850,11 @@ const tt = [
850
850
  "worldview"
851
851
  ];
852
852
  export {
853
- H as MaptilerGeocodeClearIconElement,
854
- J as MaptilerGeocodeFailIconElement,
855
- X as MaptilerGeocodeLoadingIconElement,
856
- Y as MaptilerGeocodeReverseGeocodingIconElement,
857
- ee as MaptilerGeocodeSearchIconElement,
858
- a as MaptilerGeocoderElement
853
+ J as MaptilerGeocodeClearIconElement,
854
+ X as MaptilerGeocodeFailIconElement,
855
+ Y as MaptilerGeocodeLoadingIconElement,
856
+ ee as MaptilerGeocodeReverseGeocodingIconElement,
857
+ te as MaptilerGeocodeSearchIconElement,
858
+ o as MaptilerGeocoderElement
859
859
  };
860
860
  //# sourceMappingURL=index.js.map