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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,35 @@
1
- import { css as M, LitElement as S, svg as A, html as m, unsafeCSS as he, nothing as ee } from "lit";
2
- import { customElement as O, property as d, state as b, query as qe } from "lit/decorators.js";
3
- import { convert as Ze } from "geo-coordinates-parser";
1
+ import { css as F, LitElement as O, svg as W, html as m, unsafeCSS as ce, nothing as J } from "lit";
2
+ import { customElement as S, property as d, state as b, query as Ze } from "lit/decorators.js";
3
+ import { convert as Ne } from "geo-coordinates-parser";
4
4
  import { classMap as V } from "lit/directives/class-map.js";
5
- import { repeat as Ne } from "lit/directives/repeat.js";
5
+ import { repeat as Qe } from "lit/directives/repeat.js";
6
6
  import "@turf/clone";
7
- import { styleMap as Qe } from "lit/directives/style-map.js";
7
+ import { styleMap as Ke } from "lit/directives/style-map.js";
8
8
  import { Feature as $ } from "ol";
9
- import { Control as Ke } from "ol/control";
10
- import Ye from "ol/events/Event";
11
- import { Point as X, Polygon as be, MultiPolygon as we, GeometryCollection as He, LineString as ke, MultiLineString as _e } from "ol/geom";
12
- import Je from "ol/layer/Vector";
13
- import { transformExtent as Xe, getUserProjection as et, fromLonLat as tt, toLonLat as it } from "ol/proj";
14
- import st from "ol/source/Vector";
15
- import $e from "@turf/bbox";
16
- import rt from "@turf/difference";
17
- import ot from "@turf/flatten";
18
- import { featureCollection as Le, polygon as at } from "@turf/helpers";
19
- import nt from "@turf/union";
9
+ import { Control as Ye } from "ol/control";
10
+ import He from "ol/events/Event";
11
+ import { Point as H, Polygon as be, MultiPolygon as we, GeometryCollection as Je, LineString as ke, MultiLineString as _e } from "ol/geom";
12
+ import Xe from "ol/layer/Vector";
13
+ import { transformExtent as et, getUserProjection as tt, fromLonLat as it, toLonLat as st } from "ol/proj";
14
+ import rt from "ol/source/Vector";
15
+ import Le from "@turf/bbox";
16
+ import ot from "@turf/difference";
17
+ import at from "@turf/flatten";
18
+ import { featureCollection as $e, polygon as nt } from "@turf/helpers";
19
+ import lt from "@turf/union";
20
20
  import Ie from "ol/style/Fill";
21
- import lt from "ol/style/Icon";
22
- import Me from "ol/style/Stroke";
23
- import ct from "ol/style/Style";
24
- import ht from "ol/style/Text";
25
- var dt = Object.getOwnPropertyDescriptor, pt = (t, e, i, o) => {
26
- for (var r = o > 1 ? void 0 : o ? dt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
27
- (a = t[s]) && (r = a(r) || r);
28
- return r;
21
+ import ct from "ol/style/Icon";
22
+ import Fe from "ol/style/Stroke";
23
+ import ht from "ol/style/Style";
24
+ import dt from "ol/style/Text";
25
+ var pt = Object.getOwnPropertyDescriptor, ut = (t, e, i, o) => {
26
+ for (var s = o > 1 ? void 0 : o ? pt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
27
+ (a = t[r]) && (s = a(s) || s);
28
+ return s;
29
29
  };
30
- let te = class extends S {
30
+ let X = class extends O {
31
31
  render() {
32
- return A`
32
+ return W`
33
33
  <svg viewBox="0 0 14 14" width="13" height="13">
34
34
  <path
35
35
  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"
@@ -38,23 +38,23 @@ let te = class extends S {
38
38
  `;
39
39
  }
40
40
  };
41
- te.styles = M`
41
+ X.styles = F`
42
42
  svg {
43
43
  display: block;
44
44
  fill: var(--color-icon-button);
45
45
  }
46
46
  `;
47
- te = pt([
48
- O("maptiler-geocode-clear-icon")
49
- ], te);
50
- var ut = Object.getOwnPropertyDescriptor, ft = (t, e, i, o) => {
51
- for (var r = o > 1 ? void 0 : o ? ut(e, i) : e, s = t.length - 1, a; s >= 0; s--)
52
- (a = t[s]) && (r = a(r) || r);
53
- return r;
47
+ X = ut([
48
+ S("maptiler-geocode-clear-icon")
49
+ ], X);
50
+ var ft = Object.getOwnPropertyDescriptor, mt = (t, e, i, o) => {
51
+ for (var s = o > 1 ? void 0 : o ? ft(e, i) : e, r = t.length - 1, a; r >= 0; r--)
52
+ (a = t[r]) && (s = a(s) || s);
53
+ return s;
54
54
  };
55
- let ie = class extends S {
55
+ let ee = class extends O {
56
56
  render() {
57
- return A`
57
+ return W`
58
58
  <svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
59
59
  <path
60
60
  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"
@@ -63,21 +63,21 @@ let ie = class extends S {
63
63
  `;
64
64
  }
65
65
  };
66
- ie.styles = M`
66
+ ee.styles = F`
67
67
  svg {
68
68
  display: block;
69
69
  fill: #e15042;
70
70
  }
71
71
  `;
72
- ie = ft([
73
- O("maptiler-geocode-fail-icon")
74
- ], ie);
75
- var mt = Object.getOwnPropertyDescriptor, gt = (t, e, i, o) => {
76
- for (var r = o > 1 ? void 0 : o ? mt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
77
- (a = t[s]) && (r = a(r) || r);
78
- return r;
72
+ ee = mt([
73
+ S("maptiler-geocode-fail-icon")
74
+ ], ee);
75
+ var gt = Object.getOwnPropertyDescriptor, yt = (t, e, i, o) => {
76
+ for (var s = o > 1 ? void 0 : o ? gt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
77
+ (a = t[r]) && (s = a(s) || s);
78
+ return s;
79
79
  };
80
- let se = class extends S {
80
+ let te = class extends O {
81
81
  render() {
82
82
  return m`
83
83
  <div>
@@ -89,7 +89,7 @@ let se = class extends S {
89
89
  `;
90
90
  }
91
91
  };
92
- se.styles = M`
92
+ te.styles = F`
93
93
  div {
94
94
  position: absolute;
95
95
  left: 50%;
@@ -116,17 +116,17 @@ se.styles = M`
116
116
  }
117
117
  }
118
118
  `;
119
- se = gt([
120
- O("maptiler-geocode-loading-icon")
121
- ], se);
122
- var yt = Object.getOwnPropertyDescriptor, vt = (t, e, i, o) => {
123
- for (var r = o > 1 ? void 0 : o ? yt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
124
- (a = t[s]) && (r = a(r) || r);
125
- return r;
119
+ te = yt([
120
+ S("maptiler-geocode-loading-icon")
121
+ ], te);
122
+ var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, o) => {
123
+ for (var s = o > 1 ? void 0 : o ? vt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
124
+ (a = t[r]) && (s = a(s) || s);
125
+ return s;
126
126
  };
127
- let re = class extends S {
127
+ let ie = class extends O {
128
128
  render() {
129
- return A`
129
+ return W`
130
130
  <svg viewBox="0 0 60.006 21.412" width="14" height="20">
131
131
  <path
132
132
  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"
@@ -135,23 +135,23 @@ let re = class extends S {
135
135
  `;
136
136
  }
137
137
  };
138
- re.styles = M`
138
+ ie.styles = F`
139
139
  svg {
140
140
  display: block;
141
141
  fill: var(--color-icon-button);
142
142
  }
143
143
  `;
144
- re = vt([
145
- O("maptiler-geocode-reverse-geocoding-icon")
146
- ], re);
147
- var xt = Object.getOwnPropertyDescriptor, bt = (t, e, i, o) => {
148
- for (var r = o > 1 ? void 0 : o ? xt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
149
- (a = t[s]) && (r = a(r) || r);
150
- return r;
144
+ ie = xt([
145
+ S("maptiler-geocode-reverse-geocoding-icon")
146
+ ], ie);
147
+ var bt = Object.getOwnPropertyDescriptor, wt = (t, e, i, o) => {
148
+ for (var s = o > 1 ? void 0 : o ? bt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
149
+ (a = t[r]) && (s = a(s) || s);
150
+ return s;
151
151
  };
152
- let oe = class extends S {
152
+ let se = class extends O {
153
153
  render() {
154
- return A`
154
+ return W`
155
155
  <svg
156
156
  xmlns="http://www.w3.org/2000/svg"
157
157
  width="13"
@@ -164,7 +164,7 @@ let oe = class extends S {
164
164
  `;
165
165
  }
166
166
  };
167
- oe.styles = M`
167
+ se.styles = F`
168
168
  circle {
169
169
  stroke-width: 1.875;
170
170
  fill: none;
@@ -180,48 +180,48 @@ oe.styles = M`
180
180
  stroke: var(--color-icon-button);
181
181
  }
182
182
  `;
183
- oe = bt([
184
- O("maptiler-geocode-search-icon")
185
- ], oe);
186
- function wt(t, e, i) {
187
- const o = e[1], r = e[0], s = o - r;
188
- return t === o && i ? t : ((t - r) % s + s) % s + r;
183
+ se = wt([
184
+ S("maptiler-geocode-search-icon")
185
+ ], se);
186
+ function kt(t, e, i) {
187
+ const o = e[1], s = e[0], r = o - s;
188
+ return t === o && i ? t : ((t - s) % r + r) % r + s;
189
189
  }
190
- function Z(t) {
190
+ function D(t) {
191
191
  const e = [...t];
192
192
  return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
193
193
  }
194
- let G;
195
- async function kt(t, e, i) {
194
+ let B;
195
+ async function _t(t, e, i) {
196
196
  for (const o of e ?? [])
197
197
  if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
198
198
  if (o.type === "fixed")
199
199
  return o.coordinates.join(",");
200
200
  if (o.type === "client-geolocation")
201
- if (G && o.cachedLocationExpiry && G.time + o.cachedLocationExpiry > Date.now()) {
202
- if (G.coords)
203
- return G.coords;
201
+ if (B && o.cachedLocationExpiry && B.time + o.cachedLocationExpiry > Date.now()) {
202
+ if (B.coords)
203
+ return B.coords;
204
204
  } else {
205
- let r;
205
+ let s;
206
206
  try {
207
- return r = await new Promise((s, a) => {
207
+ return s = await new Promise((r, a) => {
208
208
  i.signal.addEventListener("abort", () => {
209
209
  a(Error("aborted"));
210
210
  }), navigator.geolocation.getCurrentPosition(
211
- (f) => {
212
- s([f.coords.longitude, f.coords.latitude].map((L) => L.toFixed(6)).join(","));
211
+ (u) => {
212
+ r([u.coords.longitude, u.coords.latitude].map((y) => y.toFixed(6)).join(","));
213
213
  },
214
- (f) => {
215
- a(f);
214
+ (u) => {
215
+ a(u);
216
216
  },
217
217
  o
218
218
  );
219
- }), r;
219
+ }), s;
220
220
  } catch {
221
221
  } finally {
222
- o.cachedLocationExpiry && (G = {
222
+ o.cachedLocationExpiry && (B = {
223
223
  time: Date.now(),
224
- coords: r
224
+ coords: s
225
225
  });
226
226
  }
227
227
  if (i.signal.aborted)
@@ -233,21 +233,21 @@ async function kt(t, e, i) {
233
233
  return t[1].toFixed(6) + "," + t[2].toFixed(6);
234
234
  }
235
235
  }
236
- const _t = ".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)}}";
237
- var $t = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Se = (t) => {
236
+ const Lt = ".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)}}";
237
+ var $t = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Oe = (t) => {
238
238
  throw TypeError(t);
239
- }, _ = (t, e, i, o) => {
240
- for (var r = o > 1 ? void 0 : o ? Lt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
241
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
242
- return o && r && $t(e, i, r), r;
243
- }, Oe = (t, e, i) => e.has(t) || Se("Cannot " + i), u = (t, e, i) => (Oe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), It = (t, e, i) => e.has(t) ? Se("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), U = (t, e, i) => (Oe(t, e, "access private method"), i), p, N, z, g, Fe, Ce, de, ae;
244
- const Te = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Pe = Te ? "@2x" : "", P = Te ? 2 : 1;
245
- let C, Ee, w = class extends S {
239
+ }, L = (t, e, i, o) => {
240
+ for (var s = o > 1 ? void 0 : o ? It(e, i) : e, r = t.length - 1, a; r >= 0; r--)
241
+ (a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
242
+ return o && s && $t(e, i, s), s;
243
+ }, Se = (t, e, i) => e.has(t) || Oe("Cannot " + i), f = (t, e, i) => (Se(t, e, "read from private field"), i ? i.call(t) : e.get(t)), Ft = (t, e, i) => e.has(t) ? Oe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Se(t, e, "access private method"), i), p, q, z, g, Me, Te, he, re;
244
+ const Ce = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Pe = Ce ? "@2x" : "", P = Ce ? 2 : 1;
245
+ let C, Ee, k = class extends O {
246
246
  constructor() {
247
- super(...arguments), It(this, p), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
247
+ super(...arguments), Ft(this, p), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
248
248
  }
249
249
  willUpdate(t) {
250
- t.has("feature") && u(this, p, N) && (this.index = u(this, p, N).length, U(this, p, de).call(this));
250
+ t.has("feature") && f(this, p, q) && (this.index = f(this, p, q).length, E(this, p, he).call(this));
251
251
  }
252
252
  render() {
253
253
  return m`
@@ -262,32 +262,32 @@ let C, Ee, w = class extends S {
262
262
  ${C && this.spriteIcon ? m`
263
263
  <div
264
264
  class="sprite-icon"
265
- style=${Qe({
265
+ style=${Ke({
266
266
  width: `${this.spriteIcon.width / P}px`,
267
267
  height: `${this.spriteIcon.height / P}px`,
268
268
  backgroundImage: `url(${this.iconsBaseUrl}sprite${Pe}.png)`,
269
269
  backgroundPosition: `-${this.spriteIcon.x / P}px -${this.spriteIcon.y / P}px`,
270
270
  backgroundSize: `${C.width / P}px ${C.height / P}px`
271
271
  })}
272
- title=${u(this, p, g)}
272
+ title=${f(this, p, g)}
273
273
  />
274
- ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${u(this, p, g)} @error=${U(this, p, Ce)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : u(this, p, z) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${u(this, p, g)} title=${u(this, p, g)} /> `}
274
+ ` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, p, g)} @error=${E(this, p, Te)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : f(this, p, z) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> `}
275
275
 
276
276
  <span class="texts">
277
277
  <span>
278
- <span class="primary"> ${u(this, p, z) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
278
+ <span class="primary"> ${f(this, p, z) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
279
279
 
280
- ${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, p, z) ? m` <span class="secondary"> ${u(this, p, g)} </span> ` : ee}
280
+ ${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, p, z) ? m` <span class="secondary"> ${f(this, p, g)} </span> ` : J}
281
281
  </span>
282
282
 
283
- <span class="line2"> ${u(this, p, z) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
283
+ <span class="line2"> ${f(this, p, z) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
284
284
  </span>
285
285
  </li>
286
286
  `;
287
287
  }
288
288
  };
289
289
  p = /* @__PURE__ */ new WeakSet();
290
- N = function() {
290
+ q = function() {
291
291
  return this.feature?.properties?.categories;
292
292
  };
293
293
  z = function() {
@@ -296,75 +296,75 @@ z = function() {
296
296
  g = function() {
297
297
  return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
298
298
  };
299
- Fe = function() {
299
+ Me = function() {
300
300
  Ee ??= fetch(`${this.iconsBaseUrl}sprite${Pe}.json`).then((t) => t.json()).then((t) => {
301
301
  C = t;
302
302
  }).catch(() => {
303
303
  C = null;
304
304
  });
305
305
  };
306
- Ce = function() {
307
- this.imageUrl && this.missingIconsCache.add(this.imageUrl), U(this, p, de).call(this);
306
+ Te = function() {
307
+ this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, p, he).call(this);
308
308
  };
309
- de = function() {
310
- C !== void 0 ? U(this, p, ae).call(this) : (U(this, p, Fe).call(this), Ee?.then(() => {
311
- U(this, p, ae).call(this);
309
+ he = function() {
310
+ C !== void 0 ? E(this, p, re).call(this) : (E(this, p, Me).call(this), Ee?.then(() => {
311
+ E(this, p, re).call(this);
312
312
  }));
313
313
  };
314
- ae = function() {
314
+ re = function() {
315
315
  do {
316
- if (this.index--, this.category = u(this, p, N)?.[this.index], this.spriteIcon = this.category ? C?.icons[this.category] : void 0, this.spriteIcon)
316
+ if (this.index--, this.category = f(this, p, q)?.[this.index], this.spriteIcon = this.category ? C?.icons[this.category] : void 0, this.spriteIcon)
317
317
  break;
318
318
  this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
319
319
  } while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
320
320
  };
321
- w.styles = M`
322
- ${he(_t)}
321
+ k.styles = F`
322
+ ${ce(Lt)}
323
323
  `;
324
- _([
324
+ L([
325
325
  d({ type: Object })
326
- ], w.prototype, "feature", 2);
327
- _([
326
+ ], k.prototype, "feature", 2);
327
+ L([
328
328
  d({ type: String })
329
- ], w.prototype, "itemStyle", 2);
330
- _([
329
+ ], k.prototype, "itemStyle", 2);
330
+ L([
331
331
  d({ type: String })
332
- ], w.prototype, "showPlaceType", 2);
333
- _([
332
+ ], k.prototype, "showPlaceType", 2);
333
+ L([
334
334
  d({ attribute: !1 })
335
- ], w.prototype, "missingIconsCache", 2);
336
- _([
335
+ ], k.prototype, "missingIconsCache", 2);
336
+ L([
337
337
  d({ type: String })
338
- ], w.prototype, "iconsBaseUrl", 2);
339
- _([
338
+ ], k.prototype, "iconsBaseUrl", 2);
339
+ L([
340
340
  b()
341
- ], w.prototype, "category", 2);
342
- _([
341
+ ], k.prototype, "category", 2);
342
+ L([
343
343
  b()
344
- ], w.prototype, "imageUrl", 2);
345
- _([
344
+ ], k.prototype, "imageUrl", 2);
345
+ L([
346
346
  b()
347
- ], w.prototype, "spriteIcon", 2);
348
- _([
347
+ ], k.prototype, "spriteIcon", 2);
348
+ L([
349
349
  b()
350
- ], w.prototype, "index", 2);
351
- w = _([
352
- O("maptiler-geocoder-feature-item")
353
- ], w);
354
- const Mt = "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}";
355
- var St = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Ue = (t) => {
350
+ ], k.prototype, "index", 2);
351
+ k = L([
352
+ S("maptiler-geocoder-feature-item")
353
+ ], k);
354
+ const Ot = "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}";
355
+ var St = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Ue = (t) => {
356
356
  throw TypeError(t);
357
357
  }, c = (t, e, i, o) => {
358
- for (var r = o > 1 ? void 0 : o ? Ot(e, i) : e, s = t.length - 1, a; s >= 0; s--)
359
- (a = t[s]) && (r = (o ? a(e, i, r) : a(r)) || r);
360
- return o && r && St(e, i, r), r;
361
- }, pe = (t, e, i) => e.has(t) || Ue("Cannot " + i), x = (t, e, i) => (pe(t, e, "read from private field"), i ? i.call(t) : e.get(t)), E = (t, e, i) => e.has(t) ? Ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, o) => (pe(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (pe(t, e, "access private method"), i), Q, q, j, ne, R, n, K, Be, Ge, ue, v, fe, Y, me, ge, I, ye, H, ze, le, je, Re, Ae, De, Ve;
362
- let l = class extends S {
358
+ for (var s = o > 1 ? void 0 : o ? Mt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
359
+ (a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
360
+ return o && s && St(e, i, s), s;
361
+ }, de = (t, e, i) => e.has(t) || Ue("Cannot " + i), w = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), G = (t, e, i) => e.has(t) ? Ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), oe = (t, e, i, o) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), Z, j, ae, R, n, N, Be, pe, x, ue, Q, fe, me, I, ge, K, Ge, ne, ze, je, Re, We, Ae, Ve, De;
362
+ let l = class extends O {
363
363
  constructor() {
364
- super(...arguments), E(this, n), 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, E(this, Q, !1), E(this, q, !1), E(this, j), E(this, ne, /* @__PURE__ */ new Set()), E(this, R);
364
+ super(...arguments), G(this, n), 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, G(this, Z, !1), G(this, j), G(this, ae, /* @__PURE__ */ new Set()), G(this, R);
365
365
  }
366
366
  firstUpdated() {
367
- W(this, Q, !0);
367
+ oe(this, Z, !0);
368
368
  }
369
369
  /**
370
370
  * Set the options of this instance.
@@ -374,7 +374,7 @@ let l = class extends S {
374
374
  setOptions(t) {
375
375
  const e = { ...t };
376
376
  for (const i of Object.keys(e))
377
- Ft.includes(i) || delete e[i];
377
+ Tt.includes(i) || delete e[i];
378
378
  Object.assign(this, e);
379
379
  }
380
380
  /**
@@ -383,7 +383,7 @@ let l = class extends S {
383
383
  * @param value text to set
384
384
  */
385
385
  setQuery(t) {
386
- h(this, n, ge).call(this, t), h(this, n, me).call(this);
386
+ h(this, n, me).call(this, t, { external: !0 }), h(this, n, fe).call(this);
387
387
  }
388
388
  /**
389
389
  * Set the content of search input box and immediately submit it.
@@ -391,7 +391,7 @@ let l = class extends S {
391
391
  * @param value text to set and submit
392
392
  */
393
393
  submitQuery(t) {
394
- h(this, n, ye).call(this, t);
394
+ h(this, n, ge).call(this, t);
395
395
  }
396
396
  /**
397
397
  * Clear search result list.
@@ -421,27 +421,25 @@ let l = class extends S {
421
421
  }
422
422
  /** @internal */
423
423
  handleMapChange(t) {
424
- W(this, R, t);
424
+ oe(this, R, t);
425
425
  }
426
426
  /** @internal */
427
427
  handleMapClick(t) {
428
- this.reverseActive && h(this, n, ze).call(this, t);
428
+ this.reverseActive && h(this, n, Ge).call(this, t);
429
429
  }
430
430
  willUpdate(t) {
431
- t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && x(this, n, ue) && (h(this, n, I).call(this), this.error = void 0), ["focused"].some((e) => t.has(e)) && setTimeout(() => {
432
- this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
433
- }, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, v).call(this, "select", { feature: x(this, n, K) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
431
+ t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && w(this, n, pe) && (h(this, n, I).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: w(this, n, N) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
434
432
  () => {
435
- h(this, n, v).call(this, "pick", { feature: this.picked });
433
+ h(this, n, x).call(this, "pick", { feature: this.picked });
436
434
  },
437
435
  (e) => {
438
- e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, v).call(this, "pick", { feature: this.picked }));
436
+ e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, x).call(this, "pick", { feature: this.picked }));
439
437
  }
440
- ), ["listFeatures", "focusedDelayed"].some((e) => t.has(e)) && (x(this, n, Be) ? (h(this, n, v).call(this, "featuresshow"), W(this, q, !0)) : x(this, q) && h(this, n, v).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, v).call(this, "reversetoggle", { reverse: this.reverseActive });
438
+ ), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? h(this, n, x).call(this, "featuresshow") : h(this, n, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, x).call(this, "reversetoggle", { reverse: this.reverseActive });
441
439
  }
442
440
  render() {
443
441
  return m`
444
- <form @submit=${h(this, n, fe)} class=${V({ "can-collapse": this.collapsed && this.searchValue === "" })}>
442
+ <form @submit=${h(this, n, ue)} class=${V({ "can-collapse": this.collapsed && this.searchValue === "" })}>
445
443
  <div class="input-group">
446
444
  <button
447
445
  class="search-button"
@@ -458,16 +456,16 @@ let l = class extends S {
458
456
  @focus=${() => this.focused = !0}
459
457
  @blur=${() => this.focused = !1}
460
458
  @click=${() => this.focused = !0}
461
- @keydown=${h(this, n, le)}
462
- @input=${h(this, n, je)}
459
+ @keydown=${h(this, n, ne)}
460
+ @input=${h(this, n, ze)}
463
461
  @change=${() => this.picked = void 0}
464
462
  placeholder=${this.placeholder ?? "Search"}
465
463
  aria-label=${this.placeholder ?? "Search"}
466
464
  />
467
465
 
468
466
  <div class="clear-button-container ${V({ displayable: this.searchValue !== "" })}">
469
- ${x(this, n, Ge) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
470
- <button type="button" @click=${h(this, n, Ve)} title=${this.clearButtonTitle ?? "clear"}>
467
+ ${w(this, n, Be) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
468
+ <button type="button" @click=${h(this, n, De)} title=${this.clearButtonTitle ?? "clear"}>
471
469
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
472
470
  </button>
473
471
  `}
@@ -482,7 +480,7 @@ let l = class extends S {
482
480
  >
483
481
  <maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
484
482
  </button>
485
- ` : ee}
483
+ ` : J}
486
484
 
487
485
  <!-- <slot /> -->
488
486
  </div>
@@ -497,7 +495,7 @@ let l = class extends S {
497
495
  <maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
498
496
  </button>
499
497
  </div>
500
- ` : !this.focusedDelayed && !this.keepListOpen || this.listFeatures === void 0 ? ee : this.listFeatures.length === 0 ? m`
498
+ ` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? J : this.listFeatures.length === 0 ? m`
501
499
  <div class="no-results">
502
500
  <maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
503
501
 
@@ -506,8 +504,15 @@ let l = class extends S {
506
504
  </div>
507
505
  </div>
508
506
  ` : m`
509
- <ul class="options ${V({ "open-on-top": this.openListOnTop })}" @mouseleave=${h(this, n, De)} @keydown=${h(this, n, le)} role="listbox">
510
- ${Ne(
507
+ <ul
508
+ class="options ${V({ "open-on-top": this.openListOnTop })}"
509
+ @pointerleave=${h(this, n, We)}
510
+ @pointerdown=${h(this, n, Ae)}
511
+ @pointerup=${h(this, n, Ve)}
512
+ @keydown=${h(this, n, ne)}
513
+ role="listbox"
514
+ >
515
+ ${Qe(
511
516
  this.listFeatures,
512
517
  (t) => t.id + (t.address ? "," + t.address : ""),
513
518
  (t, e) => m`
@@ -515,17 +520,15 @@ let l = class extends S {
515
520
  .feature=${t}
516
521
  .showPlaceType=${this.showPlaceType ?? "if-needed"}
517
522
  itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
518
- @mouseenter=${() => {
519
- h(this, n, Ae).call(this, e);
523
+ @pointerenter=${() => {
524
+ h(this, n, Re).call(this, e);
520
525
  }}
521
526
  @select=${() => {
522
- h(this, n, Re).call(this, t);
527
+ h(this, n, je).call(this, t);
523
528
  }}
524
- .missingIconsCache=${x(this, ne)}
525
- .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/"}
526
- >
527
- ${t.place_name}
528
- </maptiler-geocoder-feature-item>
529
+ .missingIconsCache=${w(this, ae)}
530
+ .iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
531
+ />
529
532
  `
530
533
  )}
531
534
  </ul>
@@ -534,26 +537,22 @@ let l = class extends S {
534
537
  `;
535
538
  }
536
539
  };
537
- Q = /* @__PURE__ */ new WeakMap();
538
- q = /* @__PURE__ */ new WeakMap();
540
+ Z = /* @__PURE__ */ new WeakMap();
539
541
  j = /* @__PURE__ */ new WeakMap();
540
- ne = /* @__PURE__ */ new WeakMap();
542
+ ae = /* @__PURE__ */ new WeakMap();
541
543
  R = /* @__PURE__ */ new WeakMap();
542
544
  n = /* @__PURE__ */ new WeakSet();
543
- K = function() {
545
+ N = function() {
544
546
  return this.listFeatures?.[this.selectedItemIndex];
545
547
  };
546
548
  Be = function() {
547
- return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
548
- };
549
- Ge = function() {
550
549
  return this.abortController !== void 0;
551
550
  };
552
- ue = function() {
551
+ pe = function() {
553
552
  return this.searchValue.length < (this.minLength ?? 2);
554
553
  };
555
- v = function(t, ...[e]) {
556
- x(this, Q) && this.dispatchEvent(
554
+ x = function(t, ...[e]) {
555
+ w(this, Z) && this.dispatchEvent(
557
556
  new CustomEvent(t, {
558
557
  bubbles: !0,
559
558
  composed: !0,
@@ -561,128 +560,136 @@ v = function(t, ...[e]) {
561
560
  })
562
561
  );
563
562
  };
564
- fe = function(t) {
565
- t?.preventDefault(), this.focused = !1, clearTimeout(x(this, j)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, n, H).call(this, this.searchValue, { exact: !0 }).then(() => {
563
+ ue = function(t) {
564
+ t?.preventDefault(), this.focused = !1, clearTimeout(w(this, j)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, n, K).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
566
565
  this.picked = void 0;
567
566
  }).catch((e) => this.error = e);
568
567
  };
569
- Y = function(t) {
568
+ Q = function(t) {
570
569
  try {
571
- return Ze(t, 6);
570
+ return Ne(t, 6);
572
571
  } catch {
573
572
  return !1;
574
573
  }
575
574
  };
576
- me = function() {
575
+ fe = function() {
577
576
  setTimeout(() => {
578
577
  this.input.focus(), this.focused = !0, this.input.select();
579
578
  });
580
579
  };
581
- ge = function(t) {
582
- if (this.searchValue = t, h(this, n, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
583
- if (clearTimeout(x(this, j)), x(this, n, ue))
580
+ me = function(t, { external: e = !1 } = {}) {
581
+ if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Q).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
582
+ if (clearTimeout(w(this, j)), w(this, n, pe))
584
583
  return;
585
- const e = this.searchValue;
586
- W(this, j, window.setTimeout(() => {
587
- h(this, n, H).call(this, e).catch((i) => this.error = i);
584
+ const i = this.searchValue;
585
+ oe(this, j, window.setTimeout(() => {
586
+ h(this, n, K).call(this, i, { external: e }).catch((o) => this.error = o);
588
587
  }, this.debounceSearch ?? 200));
589
588
  } else
590
589
  h(this, n, I).call(this);
591
590
  };
592
591
  I = function() {
593
- this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, v).call(this, "featuresclear"));
592
+ this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, x).call(this, "featuresclear"));
594
593
  };
595
- ye = function(t) {
596
- this.searchValue = t, h(this, n, v).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Y).call(this, t) }), this.selectedItemIndex = -1, h(this, n, fe).call(this);
594
+ ge = function(t) {
595
+ this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Q).call(this, t) }), this.selectedItemIndex = -1, h(this, n, ue).call(this);
597
596
  };
598
- H = async function(t, { byId: e = !1, exact: i = !1 } = {}) {
597
+ K = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
599
598
  this.error = void 0, this.abortController?.abort();
600
- const o = new AbortController();
601
- this.abortController = o;
599
+ const s = new AbortController();
600
+ this.abortController = s;
602
601
  try {
603
- const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", s = h(this, n, Y).call(this, t), a = new URL(r + "/" + encodeURIComponent(s ? `${s.decimalLongitude},${s.decimalLatitude}` : t) + ".json"), f = a.searchParams;
604
- this.language !== void 0 && f.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
605
- const [L] = x(this, R) ?? [void 0];
606
- let k = (!s || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
607
- (y) => typeof y == "string" ? y : L === void 0 || (y[0] ?? 0) <= L && L < (y[1] ?? 1 / 0) ? y[2] : void 0
608
- ).filter((y) => y !== void 0);
609
- k && (k = [...new Set(k)], f.set("types", k.join(",")));
610
- const T = !s || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
611
- if (T && f.set("excludeTypes", String(T)), this.bbox && f.set("bbox", this.bbox.map((y) => y.toFixed(6)).join(",")), this.country && f.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && f.set("worldview", this.worldview), !e && !s) {
612
- const y = this.proximity ?? [{ type: "server-geolocation" }], xe = await kt(x(this, R), y, o);
613
- xe && f.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && f.set("autocomplete", "false"), f.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
602
+ const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", a = h(this, n, Q).call(this, t), u = new URL(r + "/" + encodeURIComponent(a ? `${a.decimalLongitude},${a.decimalLatitude}` : t) + ".json"), y = u.searchParams;
603
+ this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
604
+ const [M] = w(this, R) ?? [void 0];
605
+ let _ = (!a || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
606
+ (v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
607
+ ).filter((v) => v !== void 0);
608
+ _ && (_ = [...new Set(_)], y.set("types", _.join(",")));
609
+ const ye = !a || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
610
+ if (ye && y.set("excludeTypes", String(ye)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !a) {
611
+ const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await _t(w(this, R), v, s);
612
+ xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
614
613
  }
615
- const ve = this.limit ?? 5, J = this.reverseGeocodingLimit ?? ve;
616
- J > 1 && k?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), s ? (J === 1 || this.exhaustiveReverseGeocoding || k?.length === 1) && f.set("limit", String(J)) : f.set("limit", String(ve)), this.apiKey && f.set("key", this.apiKey), this.adjustUrl?.(a);
617
- const We = a.searchParams.get("types") === "" && a.searchParams.get("excludeTypes") !== "true", D = a.toString();
618
- if (D === this.lastSearchUrl) {
619
- e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, v).call(this, "featureslisted", { features: this.listFeatures }), this.listFeatures[this.selectedItemIndex]?.id !== x(this, n, K)?.id && (this.selectedItemIndex = -1));
614
+ const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
615
+ Y > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), a ? (Y === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
616
+ const qe = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", A = u.toString();
617
+ if (A === this.lastSearchUrl) {
618
+ e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1));
620
619
  return;
621
620
  }
622
- h(this, n, v).call(this, "request", { urlObj: a }), this.lastSearchUrl = D;
623
- let B;
624
- if (We)
625
- B = { type: "FeatureCollection", features: [] };
621
+ h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = A;
622
+ let U;
623
+ if (qe)
624
+ U = { type: "FeatureCollection", features: [] };
626
625
  else {
627
- const y = await fetch(D, {
628
- signal: o.signal,
626
+ const v = await fetch(A, {
627
+ signal: s.signal,
629
628
  ...this.fetchParameters
630
629
  });
631
- if (!y.ok)
632
- throw new Error(await y.text());
633
- B = await y.json();
630
+ if (!v.ok)
631
+ throw new Error(await v.text());
632
+ U = await v.json();
634
633
  }
635
- h(this, n, v).call(this, "response", { url: D, featureCollection: B }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = B.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = B.features.filter(this.filter ?? (() => !0)), s && this.listFeatures.unshift({
634
+ h(this, n, x).call(this, "response", { url: A, featureCollection: U }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = U.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = U.features.filter(this.filter ?? (() => !0)), a && this.listFeatures.unshift({
636
635
  type: "Feature",
637
636
  properties: {},
638
637
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
639
- id: `reverse_${s.decimalLongitude}_${s.decimalLatitude}`,
640
- text: `${s.decimalLatitude}, ${s.decimalLongitude}`,
641
- place_name: s.toCoordinateFormat("DMS"),
638
+ id: `reverse_${a.decimalLongitude}_${a.decimalLatitude}`,
639
+ text: `${a.decimalLatitude}, ${a.decimalLongitude}`,
640
+ place_name: a.toCoordinateFormat("DMS"),
642
641
  /* eslint-enable @typescript-eslint/restrict-template-expressions */
643
642
  place_type: ["reverse"],
644
643
  place_type_name: ["reverse"],
645
- center: [s.decimalLongitude, s.decimalLatitude],
646
- bbox: [s.decimalLongitude, s.decimalLatitude, s.decimalLongitude, s.decimalLatitude],
644
+ center: [a.decimalLongitude, a.decimalLatitude],
645
+ bbox: [a.decimalLongitude, a.decimalLatitude, a.decimalLongitude, a.decimalLatitude],
647
646
  geometry: {
648
647
  type: "Point",
649
- coordinates: [s.decimalLongitude, s.decimalLatitude]
648
+ coordinates: [a.decimalLongitude, a.decimalLatitude]
650
649
  }
651
- }), h(this, n, v).call(this, "featureslisted", { features: this.listFeatures }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== x(this, n, K)?.id && (this.selectedItemIndex = -1), s && this.input.focus());
650
+ }), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1), a && this.input.focus());
652
651
  } catch (r) {
653
652
  if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
654
653
  return;
655
654
  throw r;
656
655
  } finally {
657
- o === this.abortController && (this.abortController = void 0);
656
+ s === this.abortController && (this.abortController = void 0);
658
657
  }
659
658
  };
660
- ze = function(t) {
661
- this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ye).call(this, `${t[1].toFixed(6)}, ${wt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, me).call(this);
659
+ Ge = function(t) {
660
+ this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ge).call(this, `${t[1].toFixed(6)}, ${kt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, fe).call(this);
662
661
  };
663
- le = function(t) {
662
+ ne = function(t) {
664
663
  if (!this.listFeatures)
665
664
  return;
666
665
  const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
667
666
  e && (this.input.focus(), this.focused = !0, t.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
668
667
  };
669
- je = function(t) {
670
- h(this, n, ge).call(this, t.target.value);
668
+ ze = function(t) {
669
+ h(this, n, me).call(this, t.target.value);
671
670
  };
672
- Re = function(t) {
671
+ je = function(t) {
673
672
  (!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
674
673
  };
675
- Ae = function(t) {
674
+ Re = function(t) {
676
675
  this.selectedItemIndex = t;
677
676
  };
678
- De = function() {
679
- (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
677
+ We = function() {
678
+ (!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
679
+ };
680
+ Ae = function() {
681
+ this.isFeatureListInteractedWith = !0;
680
682
  };
681
683
  Ve = function() {
682
- this.searchValue = "", h(this, n, v).call(this, "queryclear"), this.picked = void 0, this.input.focus();
684
+ setTimeout(() => {
685
+ this.isFeatureListInteractedWith = !1;
686
+ });
687
+ };
688
+ De = function() {
689
+ this.searchValue = "", h(this, n, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
683
690
  };
684
- l.styles = M`
685
- ${he(Mt)}
691
+ l.styles = F`
692
+ ${ce(Ot)}
686
693
  `;
687
694
  c([
688
695
  d({ attribute: !1 })
@@ -796,7 +803,7 @@ c([
796
803
  d({ type: String })
797
804
  ], l.prototype, "worldview", 2);
798
805
  c([
799
- qe("input")
806
+ Ze("input")
800
807
  ], l.prototype, "input", 2);
801
808
  c([
802
809
  b()
@@ -827,11 +834,14 @@ c([
827
834
  ], l.prototype, "focused", 2);
828
835
  c([
829
836
  b()
830
- ], l.prototype, "focusedDelayed", 2);
837
+ ], l.prototype, "isFeatureListVisible", 2);
838
+ c([
839
+ b()
840
+ ], l.prototype, "isFeatureListInteractedWith", 2);
831
841
  l = c([
832
- O("maptiler-geocoder")
842
+ S("maptiler-geocoder")
833
843
  ], l);
834
- const Ft = [
844
+ const Tt = [
835
845
  "adjustUrl",
836
846
  "apiKey",
837
847
  "apiUrl",
@@ -870,14 +880,14 @@ const Ft = [
870
880
  "reverseGeocodingTypes",
871
881
  "worldview"
872
882
  ], Ct = "svg{display:block;fill:var(--maptiler-geocode-marker-fill, #3170fe);stroke:var(--maptiler-geocode-marker-stroke, #3170fe);height:30px}:host(.marker-selected){z-index:2}:host(.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fill, #98b7ff);stroke:var(--maptiler-geocode-marker-selected-stroke, #3170fe)}:host(.marker-reverse) svg path{fill:var(--maptiler-geocode-marker-reverse-fill, silver);stroke:var(--maptiler-geocode-marker-reverse-stroke, gray)}:host(.marker-interactive){cursor:pointer!important}:host(.marker-fuzzy) svg path{fill:var(--maptiler-geocode-marker-fuzzy-fill, silver);stroke:var(--maptiler-geocode-marker-fuzzy-stroke, gray)}:host(.marker-fuzzy.marker-selected) svg path{fill:var(--maptiler-geocode-marker-selected-fuzzy-fill, #ddd);stroke:var(--maptiler-geocode-marker-selected-fuzzy-stroke, silver)}";
873
- var Tt = Object.getOwnPropertyDescriptor, Pt = (t, e, i, o) => {
874
- for (var r = o > 1 ? void 0 : o ? Tt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
875
- (a = t[s]) && (r = a(r) || r);
876
- return r;
883
+ var Pt = Object.getOwnPropertyDescriptor, Et = (t, e, i, o) => {
884
+ for (var s = o > 1 ? void 0 : o ? Pt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
885
+ (a = t[r]) && (s = a(s) || s);
886
+ return s;
877
887
  };
878
- let ce = class extends S {
888
+ let le = class extends O {
879
889
  render() {
880
- return A`
890
+ return W`
881
891
  <svg
882
892
  viewBox="0 0 70 85"
883
893
  fill="none"
@@ -891,16 +901,16 @@ let ce = class extends S {
891
901
  `;
892
902
  }
893
903
  };
894
- ce.styles = M`
895
- ${he(Ct)}
904
+ le.styles = F`
905
+ ${ce(Ct)}
896
906
  `;
897
- ce = Pt([
898
- O("maptiler-geocode-marker")
899
- ], ce);
900
- function Et(t) {
901
- const e = rt(
902
- Le([
903
- at([
907
+ le = Et([
908
+ S("maptiler-geocode-marker")
909
+ ], le);
910
+ function Ut(t) {
911
+ const e = ot(
912
+ $e([
913
+ nt([
904
914
  [
905
915
  [180, 90],
906
916
  [-180, 90],
@@ -915,22 +925,22 @@ function Et(t) {
915
925
  if (!e)
916
926
  return;
917
927
  e.properties = { isMask: !0 };
918
- const i = Z($e(t)), o = (i[2] - i[0]) / 360 / 1e3, r = i[0] < -180, s = i[2] > 180, a = ot(t);
919
- if (a.features.length > 1 && (r || s))
920
- for (const f of a.features) {
921
- const L = Z($e(f));
922
- if (s && L[0] < -180 + o)
923
- for (const k of f.geometry.coordinates)
924
- for (const T of k)
925
- T[0] += 360 - o;
926
- if (r && L[2] > 180 - o)
927
- for (const k of f.geometry.coordinates)
928
- for (const T of k)
929
- T[0] -= 360 - o;
928
+ const i = D(Le(t)), o = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, r = i[2] > 180, a = at(t);
929
+ if (a.features.length > 1 && (s || r))
930
+ for (const u of a.features) {
931
+ const y = D(Le(u));
932
+ if (r && y[0] < -180 + o)
933
+ for (const M of u.geometry.coordinates)
934
+ for (const _ of M)
935
+ _[0] += 360 - o;
936
+ if (s && y[2] > 180 - o)
937
+ for (const M of u.geometry.coordinates)
938
+ for (const _ of M)
939
+ _[0] -= 360 - o;
930
940
  }
931
- return Le([a.features.length < 2 ? t : nt(a) ?? t, e]);
941
+ return $e([a.features.length < 2 ? t : lt(a) ?? t, e]);
932
942
  }
933
- const Ut = {
943
+ const Bt = {
934
944
  continental_marine: 4,
935
945
  country: 4,
936
946
  major_landform: 8,
@@ -954,28 +964,28 @@ const Ut = {
954
964
  "poi.restaurant": 18,
955
965
  "poi.aerodrome": 13
956
966
  // TODO add many more
957
- }, Bt = (t) => (e) => {
958
- const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/", o = e.getProperties(), r = e.getGeometry()?.getType(), s = o.isMask ? 0 : r === "LineString" || r === "MultiLineString" ? 3 : 2;
959
- return new ct({
960
- stroke: o.isMask ? void 0 : new Me({
967
+ }, Gt = (t) => (e) => {
968
+ const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/", o = e.getProperties(), s = e.getGeometry()?.getType(), r = o.isMask ? 0 : s === "LineString" || s === "MultiLineString" ? 3 : 2;
969
+ return new ht({
970
+ stroke: o.isMask ? void 0 : new Fe({
961
971
  color: "#3170fe",
962
- lineDash: [s, s],
963
- width: s,
972
+ lineDash: [r, r],
973
+ width: r,
964
974
  lineCap: "butt"
965
975
  }),
966
976
  fill: o.isMask ? new Ie({
967
977
  color: "#00000020"
968
978
  }) : void 0,
969
- image: new lt({
979
+ image: new ct({
970
980
  src: `${i}marker_${o.isReverse ? "reverse" : o.isSelected ? "selected" : "unselected"}.svg`,
971
981
  anchor: [0.5, 1]
972
982
  }),
973
983
  zIndex: o.isSelected ? 2 : o.isReverse ? 0 : 1,
974
- text: (o.isSelected || o.isMouseOver) && o.tooltip ? new ht({
984
+ text: (o.isSelected || o.isMouseOver) && o.tooltip ? new dt({
975
985
  backgroundFill: new Ie({ color: "white" }),
976
986
  text: o.tooltip,
977
987
  offsetY: -40,
978
- backgroundStroke: new Me({
988
+ backgroundStroke: new Fe({
979
989
  color: "white",
980
990
  lineJoin: "round",
981
991
  width: 3
@@ -983,27 +993,27 @@ const Ut = {
983
993
  padding: [2, 0, 0, 2]
984
994
  }) : void 0
985
995
  });
986
- }, F = "EPSG:4326";
987
- class ni extends Ke {
988
- #t;
996
+ }, T = "EPSG:4326";
997
+ class li extends Ye {
989
998
  #e;
999
+ #t;
990
1000
  #r;
991
1001
  constructor(e = {}) {
992
1002
  const i = document.createElement("div");
993
1003
  super({
994
1004
  element: i,
995
1005
  ...e
996
- }), this.#t = e, this.#r = document.createElement("maptiler-geocoder"), this.#r.classList.add("openlayers-geocoder"), this.#b(), i.classList.add("openlayers-ctrl-geocoder"), i.style.zIndex = "3", i.appendChild(this.#r);
1006
+ }), this.#e = e, this.#r = document.createElement("maptiler-geocoder"), this.#r.classList.add("openlayers-geocoder"), this.#b(), i.classList.add("openlayers-ctrl-geocoder"), i.style.zIndex = "3", i.appendChild(this.#r);
997
1007
  }
998
1008
  /** @internal Not to be called directly */
999
1009
  setMap(e) {
1000
- super.setMap(e), this.#e && this.#e !== e && (this.#I(), this.#P(), this.#e = void 0), e && (this.#e = e, this.#L(), this.#T());
1010
+ super.setMap(e), this.#t && this.#t !== e && (this.#I(), this.#P(), this.#t = void 0), e && (this.#t = e, this.#$(), this.#C());
1001
1011
  }
1002
1012
  getOptions() {
1003
- return { ...this.#t };
1013
+ return { ...this.#e };
1004
1014
  }
1005
1015
  setOptions(e) {
1006
- Object.assign(this.#t, e), this.#b();
1016
+ Object.assign(this.#e, e), this.#b();
1007
1017
  }
1008
1018
  setQuery(e) {
1009
1019
  this.#r.setQuery(e);
@@ -1063,11 +1073,11 @@ class ni extends Ke {
1063
1073
  },
1064
1074
  select: (e) => {
1065
1075
  const i = e.detail.feature;
1066
- i && this.#m && this.#t.flyToSelected && this.#w(i.center, this.#p(i)), this.#a && i && this.#C(i), this.#i("select", e.detail);
1076
+ i && this.#m && this.#e.flyToSelected && this.#w(i.center, this.#p(i)), this.#a && i && this.#T(i), this.#i("select", e.detail);
1067
1077
  },
1068
1078
  pick: (e) => {
1069
1079
  const i = e.detail.feature;
1070
- i && i.id !== this.#g && this.#m && (this.#M(i), this.#u(this.#a, i)), this.#g = i?.id, this.#i("pick", e.detail);
1080
+ i && i.id !== this.#g && this.#m && (this.#F(i), this.#u(this.#a, i)), this.#g = i?.id, this.#i("pick", e.detail);
1071
1081
  },
1072
1082
  featuresshow: () => {
1073
1083
  this.#i("featuresshow");
@@ -1077,7 +1087,7 @@ class ni extends Ke {
1077
1087
  },
1078
1088
  featureslisted: (e) => {
1079
1089
  const i = e.detail.features;
1080
- this.#a = i, this.#u(this.#a, void 0), this.#S(i), this.#i("featureslisted", e.detail);
1090
+ this.#a = i, this.#u(this.#a, void 0), this.#O(e), this.#i("featureslisted", e.detail);
1081
1091
  },
1082
1092
  featuresclear: () => {
1083
1093
  this.#a = void 0, this.#u(void 0, void 0), this.#i("featuresclear");
@@ -1091,103 +1101,104 @@ class ni extends Ke {
1091
1101
  };
1092
1102
  #x = {
1093
1103
  postrender: () => {
1094
- const e = this.#e?.getView().getZoom(), i = this.#e?.getView().getCenter();
1095
- this.#r.handleMapChange(e && i ? [e, ...this.#$(i)] : void 0);
1104
+ const e = this.#t?.getView().getZoom(), i = this.#t?.getView().getCenter();
1105
+ this.#r.handleMapChange(e && i ? [e, ...this.#L(i)] : void 0);
1096
1106
  },
1097
1107
  click: (e) => {
1098
- this.#r.handleMapClick(this.#$(e.coordinate)), this.#e?.forEachFeatureAtPixel(e.pixel, (i) => {
1099
- const o = i.getId(), r = this.#a?.find((s) => s.id === o);
1100
- if (!(!o || !r))
1101
- return e.stopPropagation(), this.#i("markerclick", { feature: r, marker: i }), !0;
1108
+ this.#r.handleMapClick(this.#L(e.coordinate)), this.#t?.forEachFeatureAtPixel(e.pixel, (i) => {
1109
+ const o = i.getId(), s = this.#a?.find((r) => r.id === o);
1110
+ if (!(!o || !s))
1111
+ return e.stopPropagation(), this.#i("markerclick", { feature: s, marker: i }), !0;
1102
1112
  });
1103
1113
  },
1104
1114
  pointermove: (e) => {
1105
- if (!this.#e) return;
1106
- const i = this.#e.forEachFeatureAtPixel(e.pixel, (r) => r.getId() ? r : void 0);
1107
- this.#e.getTargetElement().style.cursor = i ? "pointer" : this.#y ? "crosshair" : "";
1115
+ if (!this.#t) return;
1116
+ const i = this.#t.forEachFeatureAtPixel(e.pixel, (s) => s.getId() ? s : void 0);
1117
+ this.#t.getTargetElement().style.cursor = i ? "pointer" : this.#y ? "crosshair" : "";
1108
1118
  const o = i?.getId();
1109
1119
  if (this.#d !== o) {
1110
1120
  if (this.#d) {
1111
- const r = this.#a?.find((a) => a.id === this.#d), s = this.#c.get(r);
1112
- s?.set("isMouseOver", !1), r && s && this.#i("markermouseleave", { feature: r, marker: s });
1121
+ const s = this.#a?.find((a) => a.id === this.#d), r = this.#c.get(s);
1122
+ r?.set("isMouseOver", !1), s && r && this.#i("markermouseleave", { feature: s, marker: r });
1113
1123
  }
1114
1124
  if (i) {
1115
- const r = this.#a?.find((s) => s.id === o);
1116
- this.#i("markermouseenter", { feature: r, marker: i }), i.set("isMouseOver", !0);
1125
+ const s = this.#a?.find((r) => r.id === o);
1126
+ this.#i("markermouseenter", { feature: s, marker: i }), i.set("isMouseOver", !0);
1117
1127
  }
1118
1128
  this.#d = o;
1119
1129
  }
1120
1130
  }
1121
1131
  };
1122
1132
  #b() {
1123
- this.#r.setOptions(this.#t), this.#r.fetchFullGeometryOnPick = this.#t.pickedResultStyle !== "marker-only";
1133
+ this.#r.setOptions(this.#e), this.#r.fetchFullGeometryOnPick = this.#e.pickedResultStyle !== "marker-only";
1124
1134
  }
1125
- #L() {
1126
- if (this.#e) {
1135
+ #$() {
1136
+ if (this.#t) {
1127
1137
  for (const [e, i] of Object.entries(this.#v))
1128
1138
  this.#r.addEventListener(e, i);
1129
1139
  for (const [e, i] of Object.entries(this.#x))
1130
- this.#e.on([e], i);
1140
+ this.#t.on([e], i);
1131
1141
  }
1132
1142
  }
1133
1143
  #I() {
1134
- if (this.#e) {
1144
+ if (this.#t) {
1135
1145
  for (const [e, i] of Object.entries(this.#v))
1136
1146
  this.#r.removeEventListener(e, i);
1137
1147
  for (const [e, i] of Object.entries(this.#x))
1138
- this.#e.un([e], i);
1148
+ this.#t.un([e], i);
1139
1149
  }
1140
1150
  }
1141
1151
  #i(e, i) {
1142
- this.dispatchEvent(Object.assign(new Ye(e), i));
1152
+ this.dispatchEvent(Object.assign(new He(e), i));
1143
1153
  }
1144
- #M(e) {
1145
- e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#w(e.center, this.#p(e)) : this.#k(Z(e.bbox), 50, this.#p(e));
1154
+ #F(e) {
1155
+ e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#w(e.center, this.#p(e)) : this.#k(D(e.bbox), 50, this.#p(e));
1146
1156
  }
1147
- #S(e) {
1148
- if (!e || e.length === 0 || !this.#m) return;
1149
- const i = e.every((s) => s.matching_text), o = e.reduce(
1150
- (s, a) => i || !a.matching_text ? [Math.min(s[0], a.bbox[0]), Math.min(s[1], a.bbox[1]), Math.max(s[2], a.bbox[2]), Math.max(s[3], a.bbox[3])] : s,
1157
+ #O({ detail: { features: e, external: i } }) {
1158
+ if (!e || e.length === 0 || !this.#m || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
1159
+ return;
1160
+ const o = e.every((a) => a.matching_text), s = e.reduce(
1161
+ (a, u) => o || !u.matching_text ? [Math.min(a[0], u.bbox[0]), Math.min(a[1], u.bbox[1]), Math.max(a[2], u.bbox[2]), Math.max(a[3], u.bbox[3])] : a,
1151
1162
  [180, 90, -180, -90]
1152
- ), r = e.map((s) => this.#p(s)).filter((s) => s !== void 0).reduce((s, a) => s === void 0 ? a : Math.max(s, a), void 0);
1153
- this.#k(Z(o), 50, r);
1163
+ ), r = e.map((a) => this.#p(a)).filter((a) => a !== void 0).reduce((a, u) => a === void 0 ? u : Math.max(a, u), void 0);
1164
+ this.#k(D(s), 50, r);
1154
1165
  }
1155
1166
  #p(e) {
1156
1167
  if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
1157
1168
  return;
1158
- const i = e.id.replace(/\..*/, ""), o = this.#t.zoom ?? Ut;
1159
- return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((r, s) => {
1160
- const a = o[i + "." + s];
1161
- return r === void 0 ? a : a === void 0 ? r : Math.max(r, a);
1169
+ const i = e.id.replace(/\..*/, ""), o = this.#e.zoom ?? Bt;
1170
+ return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, r) => {
1171
+ const a = o[i + "." + r];
1172
+ return s === void 0 ? a : a === void 0 ? s : Math.max(s, a);
1162
1173
  }, void 0) : void 0) ?? o[i];
1163
1174
  }
1164
1175
  get #m() {
1165
- return !!this.#t.flyTo || this.#t.flyTo === void 0;
1176
+ return !!this.#e.flyTo || this.#e.flyTo === void 0;
1166
1177
  }
1167
- get #O() {
1168
- return typeof this.#t.flyTo == "boolean" ? {} : this.#t.flyTo;
1178
+ get #S() {
1179
+ return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1169
1180
  }
1170
- get #F() {
1171
- return typeof this.#t.flyTo == "boolean" ? {} : this.#t.flyTo;
1181
+ get #M() {
1182
+ return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
1172
1183
  }
1173
1184
  #w(e, i) {
1174
- this.#e?.getView().animate({
1185
+ this.#t?.getView().animate({
1175
1186
  center: this.#f(e),
1176
1187
  ...i ? { zoom: i } : {},
1177
1188
  duration: 2e3,
1178
- ...this.#O
1189
+ ...this.#S
1179
1190
  });
1180
1191
  }
1181
1192
  #k(e, i, o) {
1182
- this.#e?.getView().fit(Xe(e, F, this.#n()), {
1193
+ this.#t?.getView().fit(et(e, T, this.#n()), {
1183
1194
  padding: [i, i, i, i],
1184
1195
  ...o ? { maxZoom: o } : {},
1185
1196
  duration: 2e3,
1186
- ...this.#F
1197
+ ...this.#M
1187
1198
  });
1188
1199
  }
1189
1200
  #_(e) {
1190
- if (this.#t.marker === !1 || !this.#e || !this.#s)
1201
+ if (this.#e.marker === !1 || !this.#t || !this.#s)
1191
1202
  return;
1192
1203
  if (!e) {
1193
1204
  this.#o && (this.#s.removeFeature(this.#o), this.#o.dispose(), this.#o = void 0);
@@ -1195,90 +1206,90 @@ class ni extends Ke {
1195
1206
  }
1196
1207
  const i = this.#f(e);
1197
1208
  if (!this.#o) {
1198
- this.#o = new $(new X(i)), this.#o.set("isReverse", !0), this.#s.addFeature(this.#o);
1209
+ this.#o = new $(new H(i)), this.#o.set("isReverse", !0), this.#s.addFeature(this.#o);
1199
1210
  return;
1200
1211
  }
1201
1212
  this.#o.getGeometry().setCoordinates(i);
1202
1213
  }
1203
1214
  #u(e, i) {
1204
- if (!this.#e || !this.#s)
1215
+ if (!this.#t || !this.#s)
1205
1216
  return;
1206
1217
  this.#s.removeFeatures([...this.#c.values()]), this.#c = /* @__PURE__ */ new Map();
1207
1218
  const o = () => {
1208
- if (!i || !this.#e || this.#t.marker === !1) return;
1209
- const r = new $(new X(this.#f(i.center)));
1210
- r.setId(i.id), this.#c.set(i, r), this.#s?.addFeature(r);
1219
+ if (!i || !this.#t || this.#e.marker === !1) return;
1220
+ const s = new $(new H(this.#f(i.center)));
1221
+ s.setId(i.id), this.#c.set(i, s), this.#s?.addFeature(s);
1211
1222
  };
1212
1223
  if (i?.geometry.type === "GeometryCollection") {
1213
- const r = i.geometry.geometries.map((s) => s.type === "Polygon" ? new be(s.coordinates) : s.type === "MultiPolygon" ? new we(s.coordinates) : null).filter((s) => !!s);
1214
- if (r.length > 0)
1215
- this.#s.addFeature(new $(new He(r).transform(F, this.#n())));
1224
+ const s = i.geometry.geometries.map((r) => r.type === "Polygon" ? new be(r.coordinates) : r.type === "MultiPolygon" ? new we(r.coordinates) : null).filter((r) => !!r);
1225
+ if (s.length > 0)
1226
+ this.#s.addFeature(new $(new Je(s).transform(T, this.#n())));
1216
1227
  else
1217
- for (const s of i.geometry.geometries)
1218
- s.type === "LineString" ? this.#s.addFeature(new $(new ke(s.coordinates).transform(F, this.#n()))) : s.type === "MultiLineString" && this.#s.addFeature(new $(new _e(s.coordinates).transform(F, this.#n())));
1228
+ for (const r of i.geometry.geometries)
1229
+ r.type === "LineString" ? this.#s.addFeature(new $(new ke(r.coordinates).transform(T, this.#n()))) : r.type === "MultiLineString" && this.#s.addFeature(new $(new _e(r.coordinates).transform(T, this.#n())));
1219
1230
  } else if (i?.geometry.type.endsWith("Polygon")) {
1220
- const r = Et(i);
1221
- if (r)
1222
- for (const s of r.features) {
1223
- const a = s.geometry.type === "Polygon" ? new be(s.geometry.coordinates) : new we(s.geometry.coordinates);
1231
+ const s = Ut(i);
1232
+ if (s)
1233
+ for (const r of s.features) {
1234
+ const a = r.geometry.type === "Polygon" ? new be(r.geometry.coordinates) : new we(r.geometry.coordinates);
1224
1235
  this.#s.addFeature(
1225
1236
  new $({
1226
- isMask: !!s.properties?.isMask,
1227
- geometry: a.transform(F, this.#n())
1237
+ isMask: !!r.properties?.isMask,
1238
+ geometry: a.transform(T, this.#n())
1228
1239
  })
1229
1240
  );
1230
1241
  }
1231
- this.#t.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
1232
- } else i?.geometry.type === "LineString" ? this.#s.addFeature(new $(new ke(i.geometry.coordinates).transform(F, this.#n()))) : i?.geometry.type === "MultiLineString" ? this.#s.addFeature(new $(new _e(i.geometry.coordinates).transform(F, this.#n()))) : i?.geometry.type.endsWith("Point") && o();
1233
- if (this.#t.showResultMarkers !== !1)
1234
- for (const r of e ?? []) {
1235
- if (r.id === i?.id || r.place_type.includes("reverse"))
1242
+ this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
1243
+ } else i?.geometry.type === "LineString" ? this.#s.addFeature(new $(new ke(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type === "MultiLineString" ? this.#s.addFeature(new $(new _e(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type.endsWith("Point") && o();
1244
+ if (this.#e.showResultMarkers !== !1)
1245
+ for (const s of e ?? []) {
1246
+ if (s.id === i?.id || s.place_type.includes("reverse"))
1236
1247
  continue;
1237
- const s = new $(new X(this.#f(r.center)));
1238
- s.setId(r.id), s.setProperties({
1239
- fuzzy: !!r.matching_text,
1240
- tooltip: r.place_type[0] === "reverse" ? r.place_name : r.place_name.replace(/,.*/, "")
1241
- }), this.#s.addFeature(s), this.#c.set(r, s);
1248
+ const r = new $(new H(this.#f(s.center)));
1249
+ r.setId(s.id), r.setProperties({
1250
+ fuzzy: !!s.matching_text,
1251
+ tooltip: s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, "")
1252
+ }), this.#s.addFeature(r), this.#c.set(s, r);
1242
1253
  }
1243
1254
  }
1244
- #C(e) {
1245
- this.#h?.set("isSelected", !1), this.#h = void 0, this.#t.markerOnSelected !== !1 && (this.#h = this.#c.get(e), this.#h?.setProperties({ isSelected: !0 }));
1255
+ #T(e) {
1256
+ this.#h?.set("isSelected", !1), this.#h = void 0, this.#e.markerOnSelected !== !1 && (this.#h = this.#c.get(e), this.#h?.setProperties({ isSelected: !0 }));
1246
1257
  }
1247
- #T() {
1248
- this.#e && (this.#s = new st({}), this.#l = new Je({
1258
+ #C() {
1259
+ this.#t && (this.#s = new rt({}), this.#l = new Xe({
1249
1260
  updateWhileAnimating: !0
1250
- }), this.#l.setSource(this.#s), this.#l.setStyle(this.#E()), this.#e.addLayer(this.#l));
1261
+ }), this.#l.setSource(this.#s), this.#l.setStyle(this.#E()), this.#t.addLayer(this.#l));
1251
1262
  }
1252
1263
  #P() {
1253
- !this.#e || !this.#l || (this.#e.removeLayer(this.#l), this.#l = void 0);
1264
+ !this.#t || !this.#l || (this.#t.removeLayer(this.#l), this.#l = void 0);
1254
1265
  }
1255
1266
  #n() {
1256
- return et() ?? this.#e?.getView().getProjection();
1267
+ return tt() ?? this.#t?.getView().getProjection();
1257
1268
  }
1258
1269
  #f(e) {
1259
- return tt(e, this.#n());
1260
- }
1261
- #$(e) {
1262
1270
  return it(e, this.#n());
1263
1271
  }
1272
+ #L(e) {
1273
+ return st(e, this.#n());
1274
+ }
1264
1275
  #E() {
1265
- const { fullGeometryStyle: e } = this.#t;
1266
- if (e === !0 || e === void 0) return Bt(this.#t);
1276
+ const { fullGeometryStyle: e } = this.#e;
1277
+ if (e === !0 || e === void 0) return Gt(this.#e);
1267
1278
  if (!(e === !1 || e === null))
1268
1279
  return e;
1269
1280
  }
1270
1281
  }
1271
1282
  export {
1272
- Bt as DEFAULT_GEOMETRY_STYLE,
1273
- ni as GeocodingControl,
1274
- te as MaptilerGeocodeClearIconElement,
1275
- ie as MaptilerGeocodeFailIconElement,
1276
- se as MaptilerGeocodeLoadingIconElement,
1277
- ce as MaptilerGeocodeMarkerElement,
1278
- re as MaptilerGeocodeReverseGeocodingIconElement,
1279
- oe as MaptilerGeocodeSearchIconElement,
1283
+ Gt as DEFAULT_GEOMETRY_STYLE,
1284
+ li as GeocodingControl,
1285
+ X as MaptilerGeocodeClearIconElement,
1286
+ ee as MaptilerGeocodeFailIconElement,
1287
+ te as MaptilerGeocodeLoadingIconElement,
1288
+ le as MaptilerGeocodeMarkerElement,
1289
+ ie as MaptilerGeocodeReverseGeocodingIconElement,
1290
+ se as MaptilerGeocodeSearchIconElement,
1280
1291
  l as MaptilerGeocoderElement,
1281
- ni as OpenLayersGeocodingControl,
1282
- Ut as ZOOM_DEFAULTS
1292
+ li as OpenLayersGeocodingControl,
1293
+ Bt as ZOOM_DEFAULTS
1283
1294
  };
1284
1295
  //# sourceMappingURL=openlayers.public.js.map