@maptiler/geocoding-control 3.0.0-rc.6 → 3.0.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +185 -175
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +55 -50
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +312 -302
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +51 -46
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +190 -180
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +50 -45
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +235 -225
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +62 -57
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +221 -211
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +51 -46
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/geocoder/geocoder.d.ts +4 -2
- package/package.json +1 -1
package/dist/leaflet.public.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as C, property as p, state as
|
|
1
|
+
import { css as F, LitElement as O, svg as W, html as g, unsafeCSS as le, nothing as H } from "lit";
|
|
2
|
+
import { customElement as C, property as p, state as b, query as Ae } from "lit/decorators.js";
|
|
3
3
|
import { convert as Ve } from "geo-coordinates-parser";
|
|
4
|
-
import { classMap as
|
|
4
|
+
import { classMap as D } from "lit/directives/class-map.js";
|
|
5
5
|
import { repeat as qe } from "lit/directives/repeat.js";
|
|
6
6
|
import Ne from "@turf/clone";
|
|
7
7
|
import { styleMap as Ze } from "lit/directives/style-map.js";
|
|
8
|
-
import
|
|
9
|
-
import { featureCollection as
|
|
10
|
-
import
|
|
11
|
-
import { Evented as He, Control as Ye, DomEvent as
|
|
8
|
+
import Y from "@turf/bbox";
|
|
9
|
+
import { featureCollection as A, polygon as Qe, feature as Ke } from "@turf/helpers";
|
|
10
|
+
import _e from "@turf/union";
|
|
11
|
+
import { Evented as He, Control as Ye, DomEvent as xe, Popup as Je, GeoJSON as Xe, DivIcon as et, Marker as tt } from "leaflet";
|
|
12
12
|
import it from "@turf/difference";
|
|
13
13
|
import st from "@turf/flatten";
|
|
14
|
-
var
|
|
15
|
-
for (var s =
|
|
16
|
-
(
|
|
14
|
+
var rt = Object.getOwnPropertyDescriptor, ot = (t, e, i, o) => {
|
|
15
|
+
for (var s = o > 1 ? void 0 : o ? rt(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
16
|
+
(r = t[a]) && (s = r(s) || s);
|
|
17
17
|
return s;
|
|
18
18
|
};
|
|
19
|
-
let
|
|
19
|
+
let J = class extends O {
|
|
20
20
|
render() {
|
|
21
|
-
return
|
|
21
|
+
return W`
|
|
22
22
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
23
23
|
<path
|
|
24
24
|
d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
|
|
@@ -27,23 +27,23 @@ let ee = class extends O {
|
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
J.styles = F`
|
|
31
31
|
svg {
|
|
32
32
|
display: block;
|
|
33
33
|
fill: var(--color-icon-button);
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
|
-
|
|
36
|
+
J = ot([
|
|
37
37
|
C("maptiler-geocode-clear-icon")
|
|
38
|
-
],
|
|
39
|
-
var at = Object.getOwnPropertyDescriptor, nt = (t, e, i,
|
|
40
|
-
for (var s =
|
|
41
|
-
(
|
|
38
|
+
], J);
|
|
39
|
+
var at = Object.getOwnPropertyDescriptor, nt = (t, e, i, o) => {
|
|
40
|
+
for (var s = o > 1 ? void 0 : o ? at(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
41
|
+
(r = t[a]) && (s = r(s) || s);
|
|
42
42
|
return s;
|
|
43
43
|
};
|
|
44
|
-
let
|
|
44
|
+
let X = class extends O {
|
|
45
45
|
render() {
|
|
46
|
-
return
|
|
46
|
+
return W`
|
|
47
47
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
48
|
<path
|
|
49
49
|
d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
|
|
@@ -52,21 +52,21 @@ let te = class extends O {
|
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
X.styles = F`
|
|
56
56
|
svg {
|
|
57
57
|
display: block;
|
|
58
58
|
fill: #e15042;
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
-
|
|
61
|
+
X = nt([
|
|
62
62
|
C("maptiler-geocode-fail-icon")
|
|
63
|
-
],
|
|
64
|
-
var lt = Object.getOwnPropertyDescriptor, ct = (t, e, i,
|
|
65
|
-
for (var s =
|
|
66
|
-
(
|
|
63
|
+
], X);
|
|
64
|
+
var lt = Object.getOwnPropertyDescriptor, ct = (t, e, i, o) => {
|
|
65
|
+
for (var s = o > 1 ? void 0 : o ? lt(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
66
|
+
(r = t[a]) && (s = r(s) || s);
|
|
67
67
|
return s;
|
|
68
68
|
};
|
|
69
|
-
let
|
|
69
|
+
let ee = class extends O {
|
|
70
70
|
render() {
|
|
71
71
|
return g`
|
|
72
72
|
<div>
|
|
@@ -78,7 +78,7 @@ let ie = class extends O {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
ee.styles = F`
|
|
82
82
|
div {
|
|
83
83
|
position: absolute;
|
|
84
84
|
left: 50%;
|
|
@@ -105,17 +105,17 @@ ie.styles = M`
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
|
-
|
|
108
|
+
ee = ct([
|
|
109
109
|
C("maptiler-geocode-loading-icon")
|
|
110
|
-
],
|
|
111
|
-
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, i,
|
|
112
|
-
for (var s =
|
|
113
|
-
(
|
|
110
|
+
], ee);
|
|
111
|
+
var ht = Object.getOwnPropertyDescriptor, pt = (t, e, i, o) => {
|
|
112
|
+
for (var s = o > 1 ? void 0 : o ? ht(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
113
|
+
(r = t[a]) && (s = r(s) || s);
|
|
114
114
|
return s;
|
|
115
115
|
};
|
|
116
|
-
let
|
|
116
|
+
let te = class extends O {
|
|
117
117
|
render() {
|
|
118
|
-
return
|
|
118
|
+
return W`
|
|
119
119
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
120
120
|
<path
|
|
121
121
|
d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
|
|
@@ -124,23 +124,23 @@ let se = class extends O {
|
|
|
124
124
|
`;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
te.styles = F`
|
|
128
128
|
svg {
|
|
129
129
|
display: block;
|
|
130
130
|
fill: var(--color-icon-button);
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
|
-
|
|
133
|
+
te = pt([
|
|
134
134
|
C("maptiler-geocode-reverse-geocoding-icon")
|
|
135
|
-
],
|
|
136
|
-
var dt = Object.getOwnPropertyDescriptor, ut = (t, e, i,
|
|
137
|
-
for (var s =
|
|
138
|
-
(
|
|
135
|
+
], te);
|
|
136
|
+
var dt = Object.getOwnPropertyDescriptor, ut = (t, e, i, o) => {
|
|
137
|
+
for (var s = o > 1 ? void 0 : o ? dt(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
138
|
+
(r = t[a]) && (s = r(s) || s);
|
|
139
139
|
return s;
|
|
140
140
|
};
|
|
141
|
-
let
|
|
141
|
+
let ie = class extends O {
|
|
142
142
|
render() {
|
|
143
|
-
return
|
|
143
|
+
return W`
|
|
144
144
|
<svg
|
|
145
145
|
xmlns="http://www.w3.org/2000/svg"
|
|
146
146
|
width="13"
|
|
@@ -153,7 +153,7 @@ let oe = class extends O {
|
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
|
|
156
|
+
ie.styles = F`
|
|
157
157
|
circle {
|
|
158
158
|
stroke-width: 1.875;
|
|
159
159
|
fill: none;
|
|
@@ -169,61 +169,61 @@ oe.styles = M`
|
|
|
169
169
|
stroke: var(--color-icon-button);
|
|
170
170
|
}
|
|
171
171
|
`;
|
|
172
|
-
|
|
172
|
+
ie = ut([
|
|
173
173
|
C("maptiler-geocode-search-icon")
|
|
174
|
-
],
|
|
174
|
+
], ie);
|
|
175
175
|
function ft(t, e, i) {
|
|
176
|
-
const
|
|
177
|
-
return t ===
|
|
176
|
+
const o = e[1], s = e[0], a = o - s;
|
|
177
|
+
return t === o && i ? t : ((t - s) % a + a) % a + s;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function G(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
|
-
function
|
|
183
|
+
function be(t, e) {
|
|
184
184
|
const i = Ne(t);
|
|
185
|
-
for (const
|
|
186
|
-
if (
|
|
187
|
-
for (const s of
|
|
188
|
-
|
|
185
|
+
for (const o of i.features)
|
|
186
|
+
if (o.geometry.type == "MultiPolygon")
|
|
187
|
+
for (const s of o.geometry.coordinates)
|
|
188
|
+
we(s, e);
|
|
189
189
|
else
|
|
190
|
-
|
|
190
|
+
we(o.geometry.coordinates, e);
|
|
191
191
|
return i;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function we(t, e) {
|
|
194
194
|
for (const i of t)
|
|
195
|
-
for (const
|
|
196
|
-
|
|
195
|
+
for (const o of i)
|
|
196
|
+
o[0] += e;
|
|
197
197
|
}
|
|
198
|
-
let
|
|
198
|
+
let P;
|
|
199
199
|
async function mt(t, e, i) {
|
|
200
|
-
for (const
|
|
201
|
-
if (!(t && (
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
207
|
-
return
|
|
200
|
+
for (const o of e ?? [])
|
|
201
|
+
if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
|
|
202
|
+
if (o.type === "fixed")
|
|
203
|
+
return o.coordinates.join(",");
|
|
204
|
+
if (o.type === "client-geolocation")
|
|
205
|
+
if (P && o.cachedLocationExpiry && P.time + o.cachedLocationExpiry > Date.now()) {
|
|
206
|
+
if (P.coords)
|
|
207
|
+
return P.coords;
|
|
208
208
|
} else {
|
|
209
209
|
let s;
|
|
210
210
|
try {
|
|
211
|
-
return s = await new Promise((a,
|
|
211
|
+
return s = await new Promise((a, r) => {
|
|
212
212
|
i.signal.addEventListener("abort", () => {
|
|
213
|
-
|
|
213
|
+
r(Error("aborted"));
|
|
214
214
|
}), navigator.geolocation.getCurrentPosition(
|
|
215
215
|
(u) => {
|
|
216
216
|
a([u.coords.longitude, u.coords.latitude].map((m) => m.toFixed(6)).join(","));
|
|
217
217
|
},
|
|
218
218
|
(u) => {
|
|
219
|
-
|
|
219
|
+
r(u);
|
|
220
220
|
},
|
|
221
|
-
|
|
221
|
+
o
|
|
222
222
|
);
|
|
223
223
|
}), s;
|
|
224
224
|
} catch {
|
|
225
225
|
} finally {
|
|
226
|
-
|
|
226
|
+
o.cachedLocationExpiry && (P = {
|
|
227
227
|
time: Date.now(),
|
|
228
228
|
coords: s
|
|
229
229
|
});
|
|
@@ -231,27 +231,27 @@ async function mt(t, e, i) {
|
|
|
231
231
|
if (i.signal.aborted)
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
234
|
+
if (o.type === "server-geolocation")
|
|
235
235
|
return "ip";
|
|
236
|
-
if (t &&
|
|
236
|
+
if (t && o.type === "map-center")
|
|
237
237
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
const gt = ".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)}}";
|
|
241
241
|
var yt = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, Le = (t) => {
|
|
242
242
|
throw TypeError(t);
|
|
243
|
-
},
|
|
244
|
-
for (var s =
|
|
245
|
-
(
|
|
246
|
-
return
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
let
|
|
243
|
+
}, $ = (t, e, i, o) => {
|
|
244
|
+
for (var s = o > 1 ? void 0 : o ? vt(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
245
|
+
(r = t[a]) && (s = (o ? r(e, i, s) : r(s)) || s);
|
|
246
|
+
return o && s && yt(e, i, s), s;
|
|
247
|
+
}, $e = (t, e, i) => e.has(t) || Le("Cannot " + i), f = (t, e, i) => ($e(t, e, "read from private field"), i ? i.call(t) : e.get(t)), xt = (t, e, i) => e.has(t) ? Le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), S = (t, e, i) => ($e(t, e, "access private method"), i), d, V, U, y, Ie, Fe, ce, se;
|
|
248
|
+
const Oe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Ce = Oe ? "@2x" : "", T = Oe ? 2 : 1;
|
|
249
|
+
let M, Me, k = class extends O {
|
|
250
250
|
constructor() {
|
|
251
251
|
super(...arguments), xt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
252
252
|
}
|
|
253
253
|
willUpdate(t) {
|
|
254
|
-
t.has("feature") && f(this, d,
|
|
254
|
+
t.has("feature") && f(this, d, V) && (this.index = f(this, d, V).length, S(this, d, ce).call(this));
|
|
255
255
|
}
|
|
256
256
|
render() {
|
|
257
257
|
return g`
|
|
@@ -263,112 +263,112 @@ let T, Fe, k = class extends O {
|
|
|
263
263
|
class=${this.itemStyle}
|
|
264
264
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
265
265
|
>
|
|
266
|
-
${
|
|
266
|
+
${M && this.spriteIcon ? g`
|
|
267
267
|
<div
|
|
268
268
|
class="sprite-icon"
|
|
269
269
|
style=${Ze({
|
|
270
|
-
width: `${this.spriteIcon.width /
|
|
271
|
-
height: `${this.spriteIcon.height /
|
|
272
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
273
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
274
|
-
backgroundSize: `${
|
|
270
|
+
width: `${this.spriteIcon.width / T}px`,
|
|
271
|
+
height: `${this.spriteIcon.height / T}px`,
|
|
272
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Ce}.png)`,
|
|
273
|
+
backgroundPosition: `-${this.spriteIcon.x / T}px -${this.spriteIcon.y / T}px`,
|
|
274
|
+
backgroundSize: `${M.width / T}px ${M.height / T}px`
|
|
275
275
|
})}
|
|
276
276
|
title=${f(this, d, y)}
|
|
277
277
|
/>
|
|
278
|
-
` : this.imageUrl ? g` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, y)} @error=${
|
|
278
|
+
` : this.imageUrl ? g` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, y)} @error=${S(this, d, Fe)} />` : this.feature?.address ? g` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("road.") ? g` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("address.") ? g` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("postal_code.") ? g` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : this.feature?.id.startsWith("poi.") ? g` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : f(this, d, U) ? g` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> ` : g` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, y)} title=${f(this, d, y)} /> `}
|
|
279
279
|
|
|
280
280
|
<span class="texts">
|
|
281
281
|
<span>
|
|
282
|
-
<span class="primary"> ${f(this, d,
|
|
282
|
+
<span class="primary"> ${f(this, d, U) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
283
283
|
|
|
284
|
-
${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,
|
|
284
|
+
${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, U) ? g` <span class="secondary"> ${f(this, d, y)} </span> ` : H}
|
|
285
285
|
</span>
|
|
286
286
|
|
|
287
|
-
<span class="line2"> ${f(this, d,
|
|
287
|
+
<span class="line2"> ${f(this, d, U) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
288
288
|
</span>
|
|
289
289
|
</li>
|
|
290
290
|
`;
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
d = /* @__PURE__ */ new WeakSet();
|
|
294
|
-
|
|
294
|
+
V = function() {
|
|
295
295
|
return this.feature?.properties?.categories;
|
|
296
296
|
};
|
|
297
|
-
|
|
297
|
+
U = function() {
|
|
298
298
|
return this.feature?.place_type[0] === "reverse";
|
|
299
299
|
};
|
|
300
300
|
y = function() {
|
|
301
301
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
302
302
|
};
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
Ie = function() {
|
|
304
|
+
Me ??= fetch(`${this.iconsBaseUrl}sprite${Ce}.json`).then((t) => t.json()).then((t) => {
|
|
305
|
+
M = t;
|
|
306
306
|
}).catch(() => {
|
|
307
|
-
|
|
307
|
+
M = null;
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
-
|
|
311
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
310
|
+
Fe = function() {
|
|
311
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), S(this, d, ce).call(this);
|
|
312
312
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
ce = function() {
|
|
314
|
+
M !== void 0 ? S(this, d, se).call(this) : (S(this, d, Ie).call(this), Me?.then(() => {
|
|
315
|
+
S(this, d, se).call(this);
|
|
316
316
|
}));
|
|
317
317
|
};
|
|
318
|
-
|
|
318
|
+
se = function() {
|
|
319
319
|
do {
|
|
320
|
-
if (this.index--, this.category = f(this, d,
|
|
320
|
+
if (this.index--, this.category = f(this, d, V)?.[this.index], this.spriteIcon = this.category ? M?.icons[this.category] : void 0, this.spriteIcon)
|
|
321
321
|
break;
|
|
322
322
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
323
323
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
324
324
|
};
|
|
325
|
-
k.styles =
|
|
326
|
-
${
|
|
325
|
+
k.styles = F`
|
|
326
|
+
${le(gt)}
|
|
327
327
|
`;
|
|
328
|
-
|
|
328
|
+
$([
|
|
329
329
|
p({ type: Object })
|
|
330
330
|
], k.prototype, "feature", 2);
|
|
331
|
-
|
|
331
|
+
$([
|
|
332
332
|
p({ type: String })
|
|
333
333
|
], k.prototype, "itemStyle", 2);
|
|
334
|
-
|
|
334
|
+
$([
|
|
335
335
|
p({ type: String })
|
|
336
336
|
], k.prototype, "showPlaceType", 2);
|
|
337
|
-
|
|
337
|
+
$([
|
|
338
338
|
p({ attribute: !1 })
|
|
339
339
|
], k.prototype, "missingIconsCache", 2);
|
|
340
|
-
|
|
340
|
+
$([
|
|
341
341
|
p({ type: String })
|
|
342
342
|
], k.prototype, "iconsBaseUrl", 2);
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
$([
|
|
344
|
+
b()
|
|
345
345
|
], k.prototype, "category", 2);
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
$([
|
|
347
|
+
b()
|
|
348
348
|
], k.prototype, "imageUrl", 2);
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
$([
|
|
350
|
+
b()
|
|
351
351
|
], k.prototype, "spriteIcon", 2);
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
$([
|
|
353
|
+
b()
|
|
354
354
|
], k.prototype, "index", 2);
|
|
355
|
-
k =
|
|
355
|
+
k = $([
|
|
356
356
|
C("maptiler-geocoder-feature-item")
|
|
357
357
|
], k);
|
|
358
358
|
const bt = "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}";
|
|
359
|
-
var wt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor,
|
|
359
|
+
var wt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, Te = (t) => {
|
|
360
360
|
throw TypeError(t);
|
|
361
|
-
}, c = (t, e, i,
|
|
362
|
-
for (var s =
|
|
363
|
-
(
|
|
364
|
-
return
|
|
365
|
-
},
|
|
361
|
+
}, c = (t, e, i, o) => {
|
|
362
|
+
for (var s = o > 1 ? void 0 : o ? kt(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
363
|
+
(r = t[a]) && (s = (o ? r(e, i, s) : r(s)) || s);
|
|
364
|
+
return o && s && wt(e, i, s), s;
|
|
365
|
+
}, he = (t, e, i) => e.has(t) || Te("Cannot " + i), w = (t, e, i) => (he(t, e, "read from private field"), i ? i.call(t) : e.get(t)), B = (t, e, i) => e.has(t) ? Te("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), re = (t, e, i, o) => (he(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (he(t, e, "access private method"), i), q, z, oe, R, n, N, Se, pe, x, de, Z, ue, fe, I, me, Q, Ee, ae, Pe, Be, Ue, Ge, ze, Re, We;
|
|
366
366
|
let l = class extends O {
|
|
367
367
|
constructor() {
|
|
368
|
-
super(...arguments),
|
|
368
|
+
super(...arguments), B(this, n), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, B(this, q, !1), B(this, z), B(this, oe, /* @__PURE__ */ new Set()), B(this, R);
|
|
369
369
|
}
|
|
370
370
|
firstUpdated() {
|
|
371
|
-
|
|
371
|
+
re(this, q, !0);
|
|
372
372
|
}
|
|
373
373
|
/**
|
|
374
374
|
* Set the options of this instance.
|
|
@@ -387,7 +387,7 @@ let l = class extends O {
|
|
|
387
387
|
* @param value text to set
|
|
388
388
|
*/
|
|
389
389
|
setQuery(t) {
|
|
390
|
-
h(this, n,
|
|
390
|
+
h(this, n, fe).call(this, t, { external: !0 }), h(this, n, ue).call(this);
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* Set the content of search input box and immediately submit it.
|
|
@@ -395,7 +395,7 @@ let l = class extends O {
|
|
|
395
395
|
* @param value text to set and submit
|
|
396
396
|
*/
|
|
397
397
|
submitQuery(t) {
|
|
398
|
-
h(this, n,
|
|
398
|
+
h(this, n, me).call(this, t);
|
|
399
399
|
}
|
|
400
400
|
/**
|
|
401
401
|
* Clear search result list.
|
|
@@ -425,27 +425,25 @@ let l = class extends O {
|
|
|
425
425
|
}
|
|
426
426
|
/** @internal */
|
|
427
427
|
handleMapChange(t) {
|
|
428
|
-
|
|
428
|
+
re(this, R, t);
|
|
429
429
|
}
|
|
430
430
|
/** @internal */
|
|
431
431
|
handleMapClick(t) {
|
|
432
|
-
this.reverseActive && h(this, n,
|
|
432
|
+
this.reverseActive && h(this, n, Ee).call(this, t);
|
|
433
433
|
}
|
|
434
434
|
willUpdate(t) {
|
|
435
|
-
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) &&
|
|
436
|
-
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
437
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: b(this, n, 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, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
435
|
+
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && w(this, n, pe) && (h(this, n, I).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: w(this, n, N) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, Q).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
438
436
|
() => {
|
|
439
437
|
h(this, n, x).call(this, "pick", { feature: this.picked });
|
|
440
438
|
},
|
|
441
439
|
(e) => {
|
|
442
440
|
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, x).call(this, "pick", { feature: this.picked }));
|
|
443
441
|
}
|
|
444
|
-
), ["listFeatures", "
|
|
442
|
+
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? h(this, n, x).call(this, "featuresshow") : h(this, n, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, x).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
445
443
|
}
|
|
446
444
|
render() {
|
|
447
445
|
return g`
|
|
448
|
-
<form @submit=${h(this, n,
|
|
446
|
+
<form @submit=${h(this, n, de)} class=${D({ "can-collapse": this.collapsed && this.searchValue === "" })}>
|
|
449
447
|
<div class="input-group">
|
|
450
448
|
<button
|
|
451
449
|
class="search-button"
|
|
@@ -462,16 +460,16 @@ let l = class extends O {
|
|
|
462
460
|
@focus=${() => this.focused = !0}
|
|
463
461
|
@blur=${() => this.focused = !1}
|
|
464
462
|
@click=${() => this.focused = !0}
|
|
465
|
-
@keydown=${h(this, n,
|
|
466
|
-
@input=${h(this, n,
|
|
463
|
+
@keydown=${h(this, n, ae)}
|
|
464
|
+
@input=${h(this, n, Pe)}
|
|
467
465
|
@change=${() => this.picked = void 0}
|
|
468
466
|
placeholder=${this.placeholder ?? "Search"}
|
|
469
467
|
aria-label=${this.placeholder ?? "Search"}
|
|
470
468
|
/>
|
|
471
469
|
|
|
472
|
-
<div class="clear-button-container ${
|
|
473
|
-
${
|
|
474
|
-
<button type="button" @click=${h(this, n,
|
|
470
|
+
<div class="clear-button-container ${D({ displayable: this.searchValue !== "" })}">
|
|
471
|
+
${w(this, n, Se) ? g`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : g`
|
|
472
|
+
<button type="button" @click=${h(this, n, We)} title=${this.clearButtonTitle ?? "clear"}>
|
|
475
473
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
476
474
|
</button>
|
|
477
475
|
`}
|
|
@@ -480,13 +478,13 @@ let l = class extends O {
|
|
|
480
478
|
${this.enableReverse === "button" ? g`
|
|
481
479
|
<button
|
|
482
480
|
type="button"
|
|
483
|
-
class=${
|
|
481
|
+
class=${D({ active: this.reverseActive })}
|
|
484
482
|
title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}
|
|
485
483
|
@click=${() => this.reverseActive = !this.reverseActive}
|
|
486
484
|
>
|
|
487
485
|
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
488
486
|
</button>
|
|
489
|
-
` :
|
|
487
|
+
` : H}
|
|
490
488
|
|
|
491
489
|
<!-- <slot /> -->
|
|
492
490
|
</div>
|
|
@@ -501,7 +499,7 @@ let l = class extends O {
|
|
|
501
499
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
502
500
|
</button>
|
|
503
501
|
</div>
|
|
504
|
-
` : !this.
|
|
502
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? H : this.listFeatures.length === 0 ? g`
|
|
505
503
|
<div class="no-results">
|
|
506
504
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
507
505
|
|
|
@@ -510,7 +508,14 @@ let l = class extends O {
|
|
|
510
508
|
</div>
|
|
511
509
|
</div>
|
|
512
510
|
` : g`
|
|
513
|
-
<ul
|
|
511
|
+
<ul
|
|
512
|
+
class="options ${D({ "open-on-top": this.openListOnTop })}"
|
|
513
|
+
@pointerleave=${h(this, n, Ge)}
|
|
514
|
+
@pointerdown=${h(this, n, ze)}
|
|
515
|
+
@pointerup=${h(this, n, Re)}
|
|
516
|
+
@keydown=${h(this, n, ae)}
|
|
517
|
+
role="listbox"
|
|
518
|
+
>
|
|
514
519
|
${qe(
|
|
515
520
|
this.listFeatures,
|
|
516
521
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
@@ -519,17 +524,15 @@ let l = class extends O {
|
|
|
519
524
|
.feature=${t}
|
|
520
525
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
521
526
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
522
|
-
@
|
|
523
|
-
h(this, n,
|
|
527
|
+
@pointerenter=${() => {
|
|
528
|
+
h(this, n, Ue).call(this, e);
|
|
524
529
|
}}
|
|
525
530
|
@select=${() => {
|
|
526
|
-
h(this, n,
|
|
531
|
+
h(this, n, Be).call(this, t);
|
|
527
532
|
}}
|
|
528
|
-
.missingIconsCache=${
|
|
529
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
530
|
-
|
|
531
|
-
${t.place_name}
|
|
532
|
-
</maptiler-geocoder-feature-item>
|
|
533
|
+
.missingIconsCache=${w(this, oe)}
|
|
534
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.7/icons/"}
|
|
535
|
+
/>
|
|
533
536
|
`
|
|
534
537
|
)}
|
|
535
538
|
</ul>
|
|
@@ -538,26 +541,22 @@ let l = class extends O {
|
|
|
538
541
|
`;
|
|
539
542
|
}
|
|
540
543
|
};
|
|
541
|
-
|
|
542
|
-
V = /* @__PURE__ */ new WeakMap();
|
|
544
|
+
q = /* @__PURE__ */ new WeakMap();
|
|
543
545
|
z = /* @__PURE__ */ new WeakMap();
|
|
544
|
-
|
|
545
|
-
|
|
546
|
+
oe = /* @__PURE__ */ new WeakMap();
|
|
547
|
+
R = /* @__PURE__ */ new WeakMap();
|
|
546
548
|
n = /* @__PURE__ */ new WeakSet();
|
|
547
|
-
|
|
549
|
+
N = function() {
|
|
548
550
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
549
551
|
};
|
|
550
|
-
|
|
551
|
-
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
552
|
-
};
|
|
553
|
-
Pe = function() {
|
|
552
|
+
Se = function() {
|
|
554
553
|
return this.abortController !== void 0;
|
|
555
554
|
};
|
|
556
|
-
|
|
555
|
+
pe = function() {
|
|
557
556
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
558
557
|
};
|
|
559
558
|
x = function(t, ...[e]) {
|
|
560
|
-
|
|
559
|
+
w(this, q) && this.dispatchEvent(
|
|
561
560
|
new CustomEvent(t, {
|
|
562
561
|
bubbles: !0,
|
|
563
562
|
composed: !0,
|
|
@@ -565,30 +564,30 @@ x = function(t, ...[e]) {
|
|
|
565
564
|
})
|
|
566
565
|
);
|
|
567
566
|
};
|
|
568
|
-
|
|
569
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
567
|
+
de = function(t) {
|
|
568
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(w(this, z)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, n, Q).call(this, this.searchValue, { exact: !0, external: t === void 0 }).then(() => {
|
|
570
569
|
this.picked = void 0;
|
|
571
570
|
}).catch((e) => this.error = e);
|
|
572
571
|
};
|
|
573
|
-
|
|
572
|
+
Z = function(t) {
|
|
574
573
|
try {
|
|
575
574
|
return Ve(t, 6);
|
|
576
575
|
} catch {
|
|
577
576
|
return !1;
|
|
578
577
|
}
|
|
579
578
|
};
|
|
580
|
-
|
|
579
|
+
ue = function() {
|
|
581
580
|
setTimeout(() => {
|
|
582
581
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
583
582
|
});
|
|
584
583
|
};
|
|
585
|
-
|
|
586
|
-
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n,
|
|
587
|
-
if (clearTimeout(
|
|
584
|
+
fe = function(t, { external: e = !1 } = {}) {
|
|
585
|
+
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Z).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
586
|
+
if (clearTimeout(w(this, z)), w(this, n, pe))
|
|
588
587
|
return;
|
|
589
588
|
const i = this.searchValue;
|
|
590
|
-
|
|
591
|
-
h(this, n,
|
|
589
|
+
re(this, z, window.setTimeout(() => {
|
|
590
|
+
h(this, n, Q).call(this, i, { external: e }).catch((o) => this.error = o);
|
|
592
591
|
}, this.debounceSearch ?? 200));
|
|
593
592
|
} else
|
|
594
593
|
h(this, n, I).call(this);
|
|
@@ -596,37 +595,37 @@ me = function(t, { external: e = !1 } = {}) {
|
|
|
596
595
|
I = function() {
|
|
597
596
|
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, x).call(this, "featuresclear"));
|
|
598
597
|
};
|
|
599
|
-
|
|
600
|
-
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n,
|
|
598
|
+
me = function(t) {
|
|
599
|
+
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Z).call(this, t) }), this.selectedItemIndex = -1, h(this, n, de).call(this);
|
|
601
600
|
};
|
|
602
|
-
|
|
601
|
+
Q = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
603
602
|
this.error = void 0, this.abortController?.abort();
|
|
604
603
|
const s = new AbortController();
|
|
605
604
|
this.abortController = s;
|
|
606
605
|
try {
|
|
607
|
-
const a = this.apiUrl ?? "https://api.maptiler.com/geocoding",
|
|
606
|
+
const a = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = h(this, n, Z).call(this, t), u = new URL(a + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), m = u.searchParams;
|
|
608
607
|
this.language !== void 0 && m.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
609
|
-
const [_] =
|
|
610
|
-
let
|
|
608
|
+
const [_] = w(this, R) ?? [void 0];
|
|
609
|
+
let L = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
611
610
|
(v) => typeof v == "string" ? v : _ === void 0 || (v[0] ?? 0) <= _ && _ < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
612
611
|
).filter((v) => v !== void 0);
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
const v = this.proximity ?? [{ type: "server-geolocation" }],
|
|
617
|
-
|
|
612
|
+
L && (L = [...new Set(L)], m.set("types", L.join(",")));
|
|
613
|
+
const ge = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
614
|
+
if (ge && m.set("excludeTypes", String(ge)), this.bbox && m.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && m.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && m.set("worldview", this.worldview), !e && !r) {
|
|
615
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], ve = await mt(w(this, R), v, s);
|
|
616
|
+
ve && m.set("proximity", ve), (i || this.showResultsWhileTyping === !1) && m.set("autocomplete", "false"), m.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
618
617
|
}
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
const
|
|
618
|
+
const ye = this.limit ?? 5, K = this.reverseGeocodingLimit ?? ye;
|
|
619
|
+
K > 1 && L?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (K === 1 || this.exhaustiveReverseGeocoding || L?.length === 1) && m.set("limit", String(K)) : m.set("limit", String(ye)), this.apiKey && m.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
620
|
+
const De = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", j = u.toString();
|
|
622
621
|
if (j === this.lastSearchUrl) {
|
|
623
|
-
e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external:
|
|
622
|
+
e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1));
|
|
624
623
|
return;
|
|
625
624
|
}
|
|
626
625
|
h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = j;
|
|
627
|
-
let
|
|
628
|
-
if (
|
|
629
|
-
|
|
626
|
+
let E;
|
|
627
|
+
if (De)
|
|
628
|
+
E = { type: "FeatureCollection", features: [] };
|
|
630
629
|
else {
|
|
631
630
|
const v = await fetch(j, {
|
|
632
631
|
signal: s.signal,
|
|
@@ -634,25 +633,25 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: r = !1 } = {}) {
|
|
|
634
633
|
});
|
|
635
634
|
if (!v.ok)
|
|
636
635
|
throw new Error(await v.text());
|
|
637
|
-
|
|
636
|
+
E = await v.json();
|
|
638
637
|
}
|
|
639
|
-
h(this, n, x).call(this, "response", { url: j, featureCollection:
|
|
638
|
+
h(this, n, x).call(this, "response", { url: j, featureCollection: E }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = E.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = E.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
|
|
640
639
|
type: "Feature",
|
|
641
640
|
properties: {},
|
|
642
641
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
643
|
-
id: `reverse_${
|
|
644
|
-
text: `${
|
|
645
|
-
place_name:
|
|
642
|
+
id: `reverse_${r.decimalLongitude}_${r.decimalLatitude}`,
|
|
643
|
+
text: `${r.decimalLatitude}, ${r.decimalLongitude}`,
|
|
644
|
+
place_name: r.toCoordinateFormat("DMS"),
|
|
646
645
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
647
646
|
place_type: ["reverse"],
|
|
648
647
|
place_type_name: ["reverse"],
|
|
649
|
-
center: [
|
|
650
|
-
bbox: [
|
|
648
|
+
center: [r.decimalLongitude, r.decimalLatitude],
|
|
649
|
+
bbox: [r.decimalLongitude, r.decimalLatitude, r.decimalLongitude, r.decimalLatitude],
|
|
651
650
|
geometry: {
|
|
652
651
|
type: "Point",
|
|
653
|
-
coordinates: [
|
|
652
|
+
coordinates: [r.decimalLongitude, r.decimalLatitude]
|
|
654
653
|
}
|
|
655
|
-
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external:
|
|
654
|
+
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1), r && this.input.focus());
|
|
656
655
|
} catch (a) {
|
|
657
656
|
if (a && typeof a == "object" && "name" in a && a.name === "AbortError")
|
|
658
657
|
return;
|
|
@@ -661,32 +660,40 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: r = !1 } = {}) {
|
|
|
661
660
|
s === this.abortController && (this.abortController = void 0);
|
|
662
661
|
}
|
|
663
662
|
};
|
|
664
|
-
|
|
665
|
-
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n,
|
|
663
|
+
Ee = function(t) {
|
|
664
|
+
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, me).call(this, `${t[1].toFixed(6)}, ${ft(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, ue).call(this);
|
|
666
665
|
};
|
|
667
|
-
|
|
666
|
+
ae = function(t) {
|
|
668
667
|
if (!this.listFeatures)
|
|
669
668
|
return;
|
|
670
669
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
671
670
|
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));
|
|
672
671
|
};
|
|
673
|
-
|
|
674
|
-
h(this, n,
|
|
672
|
+
Pe = function(t) {
|
|
673
|
+
h(this, n, fe).call(this, t.target.value);
|
|
675
674
|
};
|
|
676
|
-
|
|
675
|
+
Be = function(t) {
|
|
677
676
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
678
677
|
};
|
|
679
|
-
|
|
678
|
+
Ue = function(t) {
|
|
680
679
|
this.selectedItemIndex = t;
|
|
681
680
|
};
|
|
682
|
-
|
|
683
|
-
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1);
|
|
681
|
+
Ge = function() {
|
|
682
|
+
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
683
|
+
};
|
|
684
|
+
ze = function() {
|
|
685
|
+
this.isFeatureListInteractedWith = !0;
|
|
684
686
|
};
|
|
685
687
|
Re = function() {
|
|
688
|
+
setTimeout(() => {
|
|
689
|
+
this.isFeatureListInteractedWith = !1;
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
We = function() {
|
|
686
693
|
this.searchValue = "", h(this, n, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
687
694
|
};
|
|
688
|
-
l.styles =
|
|
689
|
-
${
|
|
695
|
+
l.styles = F`
|
|
696
|
+
${le(bt)}
|
|
690
697
|
`;
|
|
691
698
|
c([
|
|
692
699
|
p({ attribute: !1 })
|
|
@@ -800,38 +807,41 @@ c([
|
|
|
800
807
|
p({ type: String })
|
|
801
808
|
], l.prototype, "worldview", 2);
|
|
802
809
|
c([
|
|
803
|
-
|
|
810
|
+
Ae("input")
|
|
804
811
|
], l.prototype, "input", 2);
|
|
805
812
|
c([
|
|
806
|
-
|
|
813
|
+
b()
|
|
807
814
|
], l.prototype, "searchValue", 2);
|
|
808
815
|
c([
|
|
809
|
-
|
|
816
|
+
b()
|
|
810
817
|
], l.prototype, "listFeatures", 2);
|
|
811
818
|
c([
|
|
812
|
-
|
|
819
|
+
b()
|
|
813
820
|
], l.prototype, "selectedItemIndex", 2);
|
|
814
821
|
c([
|
|
815
|
-
|
|
822
|
+
b()
|
|
816
823
|
], l.prototype, "picked", 2);
|
|
817
824
|
c([
|
|
818
|
-
|
|
825
|
+
b()
|
|
819
826
|
], l.prototype, "cachedFeatures", 2);
|
|
820
827
|
c([
|
|
821
|
-
|
|
828
|
+
b()
|
|
822
829
|
], l.prototype, "lastSearchUrl", 2);
|
|
823
830
|
c([
|
|
824
|
-
|
|
831
|
+
b()
|
|
825
832
|
], l.prototype, "error", 2);
|
|
826
833
|
c([
|
|
827
|
-
|
|
834
|
+
b()
|
|
828
835
|
], l.prototype, "abortController", 2);
|
|
829
836
|
c([
|
|
830
|
-
|
|
837
|
+
b()
|
|
831
838
|
], l.prototype, "focused", 2);
|
|
832
839
|
c([
|
|
833
|
-
|
|
834
|
-
], l.prototype, "
|
|
840
|
+
b()
|
|
841
|
+
], l.prototype, "isFeatureListVisible", 2);
|
|
842
|
+
c([
|
|
843
|
+
b()
|
|
844
|
+
], l.prototype, "isFeatureListInteractedWith", 2);
|
|
835
845
|
l = c([
|
|
836
846
|
C("maptiler-geocoder")
|
|
837
847
|
], l);
|
|
@@ -873,15 +883,15 @@ const _t = [
|
|
|
873
883
|
"types",
|
|
874
884
|
"reverseGeocodingTypes",
|
|
875
885
|
"worldview"
|
|
876
|
-
],
|
|
877
|
-
var
|
|
878
|
-
for (var s =
|
|
879
|
-
(
|
|
886
|
+
], Lt = "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)}";
|
|
887
|
+
var $t = Object.getOwnPropertyDescriptor, It = (t, e, i, o) => {
|
|
888
|
+
for (var s = o > 1 ? void 0 : o ? $t(e, i) : e, a = t.length - 1, r; a >= 0; a--)
|
|
889
|
+
(r = t[a]) && (s = r(s) || s);
|
|
880
890
|
return s;
|
|
881
891
|
};
|
|
882
|
-
let
|
|
892
|
+
let ne = class extends O {
|
|
883
893
|
render() {
|
|
884
|
-
return
|
|
894
|
+
return W`
|
|
885
895
|
<svg
|
|
886
896
|
viewBox="0 0 70 85"
|
|
887
897
|
fill="none"
|
|
@@ -895,15 +905,15 @@ let le = class extends O {
|
|
|
895
905
|
`;
|
|
896
906
|
}
|
|
897
907
|
};
|
|
898
|
-
|
|
899
|
-
${
|
|
908
|
+
ne.styles = F`
|
|
909
|
+
${le(Lt)}
|
|
900
910
|
`;
|
|
901
|
-
|
|
911
|
+
ne = It([
|
|
902
912
|
C("maptiler-geocode-marker")
|
|
903
|
-
],
|
|
904
|
-
function
|
|
913
|
+
], ne);
|
|
914
|
+
function ke(t) {
|
|
905
915
|
const e = it(
|
|
906
|
-
|
|
916
|
+
A([
|
|
907
917
|
Qe([
|
|
908
918
|
[
|
|
909
919
|
[180, 90],
|
|
@@ -919,22 +929,22 @@ function _e(t) {
|
|
|
919
929
|
if (!e)
|
|
920
930
|
return;
|
|
921
931
|
e.properties = { isMask: !0 };
|
|
922
|
-
const i =
|
|
923
|
-
if (
|
|
924
|
-
for (const u of
|
|
925
|
-
const m =
|
|
926
|
-
if (a && m[0] < -180 +
|
|
932
|
+
const i = G(Y(t)), o = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, a = i[2] > 180, r = st(t);
|
|
933
|
+
if (r.features.length > 1 && (s || a))
|
|
934
|
+
for (const u of r.features) {
|
|
935
|
+
const m = G(Y(u));
|
|
936
|
+
if (a && m[0] < -180 + o)
|
|
927
937
|
for (const _ of u.geometry.coordinates)
|
|
928
|
-
for (const
|
|
929
|
-
|
|
930
|
-
if (s && m[2] > 180 -
|
|
938
|
+
for (const L of _)
|
|
939
|
+
L[0] += 360 - o;
|
|
940
|
+
if (s && m[2] > 180 - o)
|
|
931
941
|
for (const _ of u.geometry.coordinates)
|
|
932
|
-
for (const
|
|
933
|
-
|
|
942
|
+
for (const L of _)
|
|
943
|
+
L[0] -= 360 - o;
|
|
934
944
|
}
|
|
935
|
-
return
|
|
945
|
+
return A([r.features.length < 2 ? t : _e(r) ?? t, e]);
|
|
936
946
|
}
|
|
937
|
-
const
|
|
947
|
+
const Ft = {
|
|
938
948
|
continental_marine: 4,
|
|
939
949
|
country: 4,
|
|
940
950
|
major_landform: 8,
|
|
@@ -959,20 +969,20 @@ const Mt = {
|
|
|
959
969
|
"poi.aerodrome": 13
|
|
960
970
|
// TODO add many more
|
|
961
971
|
}, Ot = (t) => {
|
|
962
|
-
const e = t?.geometry.type, i = t?.properties?.isMask,
|
|
972
|
+
const e = t?.geometry.type, i = t?.properties?.isMask, o = i ? 0 : e === "LineString" || e === "MultiLineString" ? 3 : 2;
|
|
963
973
|
return {
|
|
964
974
|
color: "#3170fe",
|
|
965
975
|
fillColor: "#000",
|
|
966
976
|
fillOpacity: i ? 0.1 : 0,
|
|
967
|
-
weight:
|
|
968
|
-
dashArray: [
|
|
977
|
+
weight: o,
|
|
978
|
+
dashArray: [o, o],
|
|
969
979
|
lineCap: "butt"
|
|
970
980
|
};
|
|
971
981
|
};
|
|
972
982
|
class je extends Ye {
|
|
973
983
|
}
|
|
974
984
|
Object.assign(je.prototype, He.prototype);
|
|
975
|
-
class
|
|
985
|
+
class Dt extends je {
|
|
976
986
|
#e;
|
|
977
987
|
#t;
|
|
978
988
|
constructor(e = {}) {
|
|
@@ -982,11 +992,11 @@ class At extends je {
|
|
|
982
992
|
onAdd(e) {
|
|
983
993
|
this.#e = e, this.#t = e.getContainer().ownerDocument.createElement("maptiler-geocoder"), this.#t.classList.add("leaflet-geocoder"), this.#m(), this.#x(), this.#I();
|
|
984
994
|
const i = e.getContainer().ownerDocument.createElement("div");
|
|
985
|
-
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t),
|
|
995
|
+
return i.classList.add("leaflet-ctrl-geocoder", "leaflet-bar"), i.style.zIndex = "850", i.appendChild(this.#t), xe.disableClickPropagation(i), xe.disableScrollPropagation(i), i;
|
|
986
996
|
}
|
|
987
997
|
/** @internal Not to be called directly */
|
|
988
998
|
onRemove() {
|
|
989
|
-
this.#b(), this.#
|
|
999
|
+
this.#b(), this.#F(), this.#e = void 0, this.#t = void 0;
|
|
990
1000
|
}
|
|
991
1001
|
getOptions() {
|
|
992
1002
|
return { ...this.options };
|
|
@@ -1001,7 +1011,7 @@ class At extends je {
|
|
|
1001
1011
|
this.#t?.submitQuery(e);
|
|
1002
1012
|
}
|
|
1003
1013
|
clearMap() {
|
|
1004
|
-
this.#
|
|
1014
|
+
this.#o = [], this.#c(void 0, void 0);
|
|
1005
1015
|
}
|
|
1006
1016
|
clearList() {
|
|
1007
1017
|
this.#t?.clearList();
|
|
@@ -1020,9 +1030,9 @@ class At extends je {
|
|
|
1020
1030
|
/** Marker representing the selected feature */
|
|
1021
1031
|
#n;
|
|
1022
1032
|
/** Marker representing the picked feature */
|
|
1023
|
-
#o;
|
|
1024
|
-
/** Features currently marked on the map */
|
|
1025
1033
|
#r;
|
|
1034
|
+
/** Features currently marked on the map */
|
|
1035
|
+
#o;
|
|
1026
1036
|
/** Remember last feature that the map flew to as to not do it again */
|
|
1027
1037
|
#d;
|
|
1028
1038
|
/** Layer used for showing geometry results */
|
|
@@ -1047,11 +1057,11 @@ class At extends je {
|
|
|
1047
1057
|
},
|
|
1048
1058
|
select: (e) => {
|
|
1049
1059
|
const i = e.detail.feature;
|
|
1050
|
-
i && this.#h && this.options.flyToSelected && this.#g({ lng: i.center[0], lat: i.center[1] }, this.#l(i)), this.#
|
|
1060
|
+
i && this.#h && this.options.flyToSelected && this.#g({ lng: i.center[0], lat: i.center[1] }, this.#l(i)), this.#o && i && this.#$(i), this.#i("select", e.detail);
|
|
1051
1061
|
},
|
|
1052
1062
|
pick: (e) => {
|
|
1053
1063
|
const i = e.detail.feature;
|
|
1054
|
-
i && i.id !== this.#d && this.#h && (this.#w(i), this.#c(this.#
|
|
1064
|
+
i && i.id !== this.#d && this.#h && (this.#w(i), this.#c(this.#o, i)), this.#d = i?.id, this.#i("pick", e.detail);
|
|
1055
1065
|
},
|
|
1056
1066
|
featuresshow: () => {
|
|
1057
1067
|
this.#i("featuresshow");
|
|
@@ -1061,10 +1071,10 @@ class At extends je {
|
|
|
1061
1071
|
},
|
|
1062
1072
|
featureslisted: (e) => {
|
|
1063
1073
|
const i = e.detail.features;
|
|
1064
|
-
this.#
|
|
1074
|
+
this.#o = i, this.#c(this.#o, void 0), this.#k(e), this.#i("featureslisted", e.detail);
|
|
1065
1075
|
},
|
|
1066
1076
|
featuresclear: () => {
|
|
1067
|
-
this.#
|
|
1077
|
+
this.#o = void 0, this.#c(void 0, void 0), this.#i("featuresclear");
|
|
1068
1078
|
},
|
|
1069
1079
|
focusin: () => {
|
|
1070
1080
|
this.#i("focusin");
|
|
@@ -1103,25 +1113,25 @@ class At extends je {
|
|
|
1103
1113
|
return super.fire(e, i);
|
|
1104
1114
|
}
|
|
1105
1115
|
#w(e) {
|
|
1106
|
-
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#g({ lng: e.center[0], lat: e.center[1] }, this.#l(e)) : this.#y(
|
|
1116
|
+
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#g({ lng: e.center[0], lat: e.center[1] }, this.#l(e)) : this.#y(G(e.bbox), 50, this.#l(e));
|
|
1107
1117
|
}
|
|
1108
1118
|
#k({ detail: { features: e, external: i } }) {
|
|
1109
1119
|
if (!e || e.length === 0 || !this.#h || this.options.flyToFeatures === !1 || this.options.flyToFeatures === "never" || !i && (this.options.flyToFeatures === void 0 || this.options.flyToFeatures === "external"))
|
|
1110
1120
|
return;
|
|
1111
|
-
const
|
|
1112
|
-
(
|
|
1121
|
+
const o = e.every((r) => r.matching_text), s = e.reduce(
|
|
1122
|
+
(r, u) => o || !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
1123
|
[180, 90, -180, -90]
|
|
1114
|
-
), a = e.map((
|
|
1115
|
-
this.#y(
|
|
1124
|
+
), a = e.map((r) => this.#l(r)).filter((r) => r !== void 0).reduce((r, u) => r === void 0 ? u : Math.max(r, u), void 0);
|
|
1125
|
+
this.#y(G(s), 50, a);
|
|
1116
1126
|
}
|
|
1117
1127
|
#l(e) {
|
|
1118
1128
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1119
1129
|
return;
|
|
1120
|
-
const i = e.id.replace(/\..*/, ""),
|
|
1130
|
+
const i = e.id.replace(/\..*/, ""), o = this.options.zoom ?? Ft;
|
|
1121
1131
|
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, a) => {
|
|
1122
|
-
const
|
|
1123
|
-
return s === void 0 ?
|
|
1124
|
-
}, void 0) : void 0) ??
|
|
1132
|
+
const r = o[i + "." + a];
|
|
1133
|
+
return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
|
|
1134
|
+
}, void 0) : void 0) ?? o[i];
|
|
1125
1135
|
}
|
|
1126
1136
|
get #h() {
|
|
1127
1137
|
return !!this.options.flyTo || this.options.flyTo === void 0;
|
|
@@ -1129,28 +1139,28 @@ class At extends je {
|
|
|
1129
1139
|
get #_() {
|
|
1130
1140
|
return typeof this.options.flyTo == "boolean" ? {} : this.options.flyTo;
|
|
1131
1141
|
}
|
|
1132
|
-
get
|
|
1142
|
+
get #L() {
|
|
1133
1143
|
return typeof this.options.flyTo == "boolean" ? {} : this.options.flyTo;
|
|
1134
1144
|
}
|
|
1135
1145
|
#g(e, i) {
|
|
1136
1146
|
this.#e?.flyTo(e, i, this.#_ ?? void 0);
|
|
1137
1147
|
}
|
|
1138
|
-
#y(e, i,
|
|
1148
|
+
#y(e, i, o) {
|
|
1139
1149
|
this.#e?.fitBounds(
|
|
1140
1150
|
[
|
|
1141
1151
|
[e[1], e[0]],
|
|
1142
1152
|
[e[3], e[2]]
|
|
1143
1153
|
],
|
|
1144
|
-
{ padding: [i, i], ...
|
|
1154
|
+
{ padding: [i, i], ...o ? { maxZoom: o } : {}, ...this.#L }
|
|
1145
1155
|
);
|
|
1146
1156
|
}
|
|
1147
1157
|
#v(e) {
|
|
1148
1158
|
if (!(this.options.marker === !1 || this.options.marker === null || !this.#e)) {
|
|
1149
1159
|
if (!e) {
|
|
1150
|
-
this.#
|
|
1160
|
+
this.#r?.remove(), this.#r = void 0;
|
|
1151
1161
|
return;
|
|
1152
1162
|
}
|
|
1153
|
-
this.#
|
|
1163
|
+
this.#r || (this.options.marker instanceof Function ? this.#r = this.options.marker(this.#e) ?? void 0 : (this.#r = this.#p(e, this.options.marker).addTo(this.#e), this.#r.getElement()?.classList.add("marker-reverse"))), this.#r?.setLatLng(e);
|
|
1154
1164
|
}
|
|
1155
1165
|
}
|
|
1156
1166
|
#c(e, i) {
|
|
@@ -1159,7 +1169,7 @@ class At extends je {
|
|
|
1159
1169
|
for (const s of this.#a.values())
|
|
1160
1170
|
s.remove();
|
|
1161
1171
|
this.#a = /* @__PURE__ */ new Map(), this.#s?.clearLayers();
|
|
1162
|
-
const
|
|
1172
|
+
const o = () => {
|
|
1163
1173
|
if (!i || !this.#e || this.options.marker === !1 || this.options.marker === null) return;
|
|
1164
1174
|
const s = this.options.marker instanceof Function ? this.options.marker(this.#e, i) : this.#p({ lng: i.center[0], lat: i.center[1] }, this.options.marker).addTo(this.#e);
|
|
1165
1175
|
s && this.#a.set(i, s);
|
|
@@ -1169,17 +1179,17 @@ class At extends je {
|
|
|
1169
1179
|
(a) => a.type === "Polygon" || a.type === "MultiPolygon"
|
|
1170
1180
|
);
|
|
1171
1181
|
if (s.length > 0) {
|
|
1172
|
-
const a =
|
|
1182
|
+
const a = _e(A(s.map((r) => Ke(r))));
|
|
1173
1183
|
if (a) {
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1176
|
-
const u = [...
|
|
1177
|
-
m[0] - _ / 4 < -180 && u.push(...
|
|
1184
|
+
const r = ke({ ...i, geometry: a.geometry });
|
|
1185
|
+
if (r) {
|
|
1186
|
+
const u = [...r.features], m = G(Y(i)), _ = m[2] - m[0];
|
|
1187
|
+
m[0] - _ / 4 < -180 && u.push(...be(r, -360).features), m[2] + _ / 4 > 180 && u.push(...be(r, 360).features), this.#s?.addData(A(u));
|
|
1178
1188
|
}
|
|
1179
1189
|
}
|
|
1180
1190
|
} else {
|
|
1181
1191
|
const a = i.geometry.geometries.filter(
|
|
1182
|
-
(
|
|
1192
|
+
(r) => r.type === "LineString" || r.type === "MultiLineString"
|
|
1183
1193
|
);
|
|
1184
1194
|
a.length > 0 && this.#s?.addData({
|
|
1185
1195
|
...i,
|
|
@@ -1187,9 +1197,9 @@ class At extends je {
|
|
|
1187
1197
|
});
|
|
1188
1198
|
}
|
|
1189
1199
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1190
|
-
const s =
|
|
1191
|
-
s && this.#s?.addData(s), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" &&
|
|
1192
|
-
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") &&
|
|
1200
|
+
const s = ke(i);
|
|
1201
|
+
s && this.#s?.addData(s), this.options.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
|
|
1202
|
+
} else i?.geometry.type.endsWith("LineString") ? this.#s?.addData(i) : i?.geometry.type.endsWith("Point") && o();
|
|
1193
1203
|
if (this.options.showResultMarkers !== !1 && this.options.showResultMarkers !== null)
|
|
1194
1204
|
for (const s of e ?? []) {
|
|
1195
1205
|
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
@@ -1207,17 +1217,17 @@ class At extends je {
|
|
|
1207
1217
|
className: "maptiler-gc-popup"
|
|
1208
1218
|
}).setContent(s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, ""))
|
|
1209
1219
|
).addTo(this.#e), a.getElement()?.classList.add("marker-interactive");
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1220
|
+
const r = a.getElement();
|
|
1221
|
+
r?.addEventListener("click", (u) => {
|
|
1212
1222
|
u.stopPropagation(), this.#i("markerclick", { feature: s, marker: a });
|
|
1213
|
-
}),
|
|
1223
|
+
}), r?.addEventListener("mouseenter", () => {
|
|
1214
1224
|
this.#i("markermouseenter", { feature: s, marker: a }), a.togglePopup();
|
|
1215
|
-
}),
|
|
1225
|
+
}), r?.addEventListener("mouseleave", () => {
|
|
1216
1226
|
this.#i("markermouseleave", { feature: s, marker: a }), a.togglePopup();
|
|
1217
|
-
}),
|
|
1227
|
+
}), r?.classList.toggle("marker-fuzzy", !!s.matching_text), this.#a.set(s, a);
|
|
1218
1228
|
}
|
|
1219
1229
|
}
|
|
1220
|
-
|
|
1230
|
+
#$(e) {
|
|
1221
1231
|
this.#n?.getElement()?.classList.toggle("marker-selected", !1), this.#n = void 0, this.options.markerOnSelected !== !1 && (this.#n = this.#a.get(e), this.#n?.getElement()?.classList.toggle("marker-selected", !0));
|
|
1222
1232
|
}
|
|
1223
1233
|
#I() {
|
|
@@ -1226,7 +1236,7 @@ class At extends je {
|
|
|
1226
1236
|
interactive: !1
|
|
1227
1237
|
}).addTo(this.#e));
|
|
1228
1238
|
}
|
|
1229
|
-
#
|
|
1239
|
+
#F() {
|
|
1230
1240
|
this.#e && (this.#s?.removeFrom(this.#e), this.#s = void 0);
|
|
1231
1241
|
}
|
|
1232
1242
|
#p(e, i) {
|
|
@@ -1241,15 +1251,15 @@ class At extends je {
|
|
|
1241
1251
|
}
|
|
1242
1252
|
export {
|
|
1243
1253
|
Ot as DEFAULT_GEOMETRY_STYLE,
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1254
|
+
Dt as GeocodingControl,
|
|
1255
|
+
Dt as LeafletGeocodingControl,
|
|
1256
|
+
J as MaptilerGeocodeClearIconElement,
|
|
1257
|
+
X as MaptilerGeocodeFailIconElement,
|
|
1258
|
+
ee as MaptilerGeocodeLoadingIconElement,
|
|
1259
|
+
ne as MaptilerGeocodeMarkerElement,
|
|
1260
|
+
te as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1261
|
+
ie as MaptilerGeocodeSearchIconElement,
|
|
1252
1262
|
l as MaptilerGeocoderElement,
|
|
1253
|
-
|
|
1263
|
+
Ft as ZOOM_DEFAULTS
|
|
1254
1264
|
};
|
|
1255
1265
|
//# sourceMappingURL=leaflet.public.js.map
|