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