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