@maptiler/geocoding-control 3.0.0-rc.6 → 3.0.0-rc.8
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/check-version.js +69 -0
- package/dist/check-version.d.ts +1 -0
- package/dist/index.js +188 -178
- 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 +313 -303
- 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 +188 -178
- 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 +243 -233
- 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 +225 -214
- 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/components/clear-icon.d.ts +1 -0
- package/dist/src/components/fail-icon.d.ts +1 -0
- package/dist/src/components/loading-icon.d.ts +1 -0
- package/dist/src/components/marker.d.ts +1 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +1 -0
- package/dist/src/components/search-icon.d.ts +1 -0
- package/dist/src/controls/maplibregl-control.d.ts +2 -7
- package/dist/src/controls/maplibregl-events.d.ts +2 -3
- package/dist/src/controls/maplibregl-options.d.ts +1 -9
- package/dist/src/geocoder/geocoder-feature-item.d.ts +1 -0
- package/dist/src/geocoder/geocoder.d.ts +5 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/leaflet.public.d.ts +1 -0
- package/dist/src/maplibregl.d.ts +1 -0
- package/dist/src/maptilersdk.d.ts +1 -0
- package/dist/src/openlayers.public.d.ts +1 -0
- package/package.json +20 -10
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { css as F, LitElement as
|
|
2
|
-
import { customElement as S, property as d, state as
|
|
1
|
+
import { css as F, LitElement as O, svg as W, html as m, unsafeCSS as ce, nothing as J } from "lit";
|
|
2
|
+
import { customElement as S, property as d, state as b, query as Ze } from "lit/decorators.js";
|
|
3
3
|
import { convert as Ne } from "geo-coordinates-parser";
|
|
4
4
|
import { classMap as V } from "lit/directives/class-map.js";
|
|
5
5
|
import { repeat as Qe } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
7
|
import { styleMap as Ke } from "lit/directives/style-map.js";
|
|
8
|
-
import { Feature as
|
|
8
|
+
import { Feature as $ } from "ol";
|
|
9
9
|
import { Control as Ye } from "ol/control";
|
|
10
10
|
import He from "ol/events/Event";
|
|
11
|
-
import { Point as
|
|
11
|
+
import { Point as H, Polygon as be, MultiPolygon as we, GeometryCollection as Je, LineString as ke, MultiLineString as _e } from "ol/geom";
|
|
12
12
|
import Xe from "ol/layer/Vector";
|
|
13
13
|
import { transformExtent as et, getUserProjection as tt, fromLonLat as it, toLonLat as st } from "ol/proj";
|
|
14
14
|
import rt from "ol/source/Vector";
|
|
15
15
|
import Le from "@turf/bbox";
|
|
16
16
|
import ot from "@turf/difference";
|
|
17
17
|
import at from "@turf/flatten";
|
|
18
|
-
import { featureCollection as
|
|
18
|
+
import { featureCollection as $e, polygon as nt } from "@turf/helpers";
|
|
19
19
|
import lt from "@turf/union";
|
|
20
|
-
import
|
|
20
|
+
import Ie from "ol/style/Fill";
|
|
21
21
|
import ct from "ol/style/Icon";
|
|
22
|
-
import
|
|
22
|
+
import Fe from "ol/style/Stroke";
|
|
23
23
|
import ht from "ol/style/Style";
|
|
24
24
|
import dt from "ol/style/Text";
|
|
25
25
|
var pt = Object.getOwnPropertyDescriptor, ut = (t, e, i, o) => {
|
|
@@ -27,9 +27,9 @@ var pt = Object.getOwnPropertyDescriptor, ut = (t, e, i, o) => {
|
|
|
27
27
|
(a = t[r]) && (s = a(s) || s);
|
|
28
28
|
return s;
|
|
29
29
|
};
|
|
30
|
-
let
|
|
30
|
+
let X = class extends O {
|
|
31
31
|
render() {
|
|
32
|
-
return
|
|
32
|
+
return W`
|
|
33
33
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
34
34
|
<path
|
|
35
35
|
d="M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"
|
|
@@ -38,23 +38,23 @@ let te = class extends M {
|
|
|
38
38
|
`;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
X.styles = F`
|
|
42
42
|
svg {
|
|
43
43
|
display: block;
|
|
44
44
|
fill: var(--color-icon-button);
|
|
45
45
|
}
|
|
46
46
|
`;
|
|
47
|
-
|
|
47
|
+
X = ut([
|
|
48
48
|
S("maptiler-geocode-clear-icon")
|
|
49
|
-
],
|
|
49
|
+
], X);
|
|
50
50
|
var ft = Object.getOwnPropertyDescriptor, mt = (t, e, i, o) => {
|
|
51
51
|
for (var s = o > 1 ? void 0 : o ? ft(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
52
52
|
(a = t[r]) && (s = a(s) || s);
|
|
53
53
|
return s;
|
|
54
54
|
};
|
|
55
|
-
let
|
|
55
|
+
let ee = class extends O {
|
|
56
56
|
render() {
|
|
57
|
-
return
|
|
57
|
+
return W`
|
|
58
58
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
59
59
|
<path
|
|
60
60
|
d="M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"
|
|
@@ -63,21 +63,21 @@ let ie = class extends M {
|
|
|
63
63
|
`;
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
ee.styles = F`
|
|
67
67
|
svg {
|
|
68
68
|
display: block;
|
|
69
69
|
fill: #e15042;
|
|
70
70
|
}
|
|
71
71
|
`;
|
|
72
|
-
|
|
72
|
+
ee = mt([
|
|
73
73
|
S("maptiler-geocode-fail-icon")
|
|
74
|
-
],
|
|
74
|
+
], ee);
|
|
75
75
|
var gt = Object.getOwnPropertyDescriptor, yt = (t, e, i, o) => {
|
|
76
76
|
for (var s = o > 1 ? void 0 : o ? gt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
77
77
|
(a = t[r]) && (s = a(s) || s);
|
|
78
78
|
return s;
|
|
79
79
|
};
|
|
80
|
-
let
|
|
80
|
+
let te = class extends O {
|
|
81
81
|
render() {
|
|
82
82
|
return m`
|
|
83
83
|
<div>
|
|
@@ -89,7 +89,7 @@ let se = class extends M {
|
|
|
89
89
|
`;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
te.styles = F`
|
|
93
93
|
div {
|
|
94
94
|
position: absolute;
|
|
95
95
|
left: 50%;
|
|
@@ -116,17 +116,17 @@ se.styles = F`
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
`;
|
|
119
|
-
|
|
119
|
+
te = yt([
|
|
120
120
|
S("maptiler-geocode-loading-icon")
|
|
121
|
-
],
|
|
121
|
+
], te);
|
|
122
122
|
var vt = Object.getOwnPropertyDescriptor, xt = (t, e, i, o) => {
|
|
123
123
|
for (var s = o > 1 ? void 0 : o ? vt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
124
124
|
(a = t[r]) && (s = a(s) || s);
|
|
125
125
|
return s;
|
|
126
126
|
};
|
|
127
|
-
let
|
|
127
|
+
let ie = class extends O {
|
|
128
128
|
render() {
|
|
129
|
-
return
|
|
129
|
+
return W`
|
|
130
130
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
131
131
|
<path
|
|
132
132
|
d="M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"
|
|
@@ -135,23 +135,23 @@ let re = class extends M {
|
|
|
135
135
|
`;
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
ie.styles = F`
|
|
139
139
|
svg {
|
|
140
140
|
display: block;
|
|
141
141
|
fill: var(--color-icon-button);
|
|
142
142
|
}
|
|
143
143
|
`;
|
|
144
|
-
|
|
144
|
+
ie = xt([
|
|
145
145
|
S("maptiler-geocode-reverse-geocoding-icon")
|
|
146
|
-
],
|
|
146
|
+
], ie);
|
|
147
147
|
var bt = Object.getOwnPropertyDescriptor, wt = (t, e, i, o) => {
|
|
148
148
|
for (var s = o > 1 ? void 0 : o ? bt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
149
149
|
(a = t[r]) && (s = a(s) || s);
|
|
150
150
|
return s;
|
|
151
151
|
};
|
|
152
|
-
let
|
|
152
|
+
let se = class extends O {
|
|
153
153
|
render() {
|
|
154
|
-
return
|
|
154
|
+
return W`
|
|
155
155
|
<svg
|
|
156
156
|
xmlns="http://www.w3.org/2000/svg"
|
|
157
157
|
width="13"
|
|
@@ -164,7 +164,7 @@ let oe = class extends M {
|
|
|
164
164
|
`;
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
se.styles = F`
|
|
168
168
|
circle {
|
|
169
169
|
stroke-width: 1.875;
|
|
170
170
|
fill: none;
|
|
@@ -180,27 +180,27 @@ oe.styles = F`
|
|
|
180
180
|
stroke: var(--color-icon-button);
|
|
181
181
|
}
|
|
182
182
|
`;
|
|
183
|
-
|
|
183
|
+
se = wt([
|
|
184
184
|
S("maptiler-geocode-search-icon")
|
|
185
|
-
],
|
|
185
|
+
], se);
|
|
186
186
|
function kt(t, e, i) {
|
|
187
187
|
const o = e[1], s = e[0], r = o - s;
|
|
188
188
|
return t === o && i ? t : ((t - s) % r + r) % r + s;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function D(t) {
|
|
191
191
|
const e = [...t];
|
|
192
192
|
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
193
193
|
}
|
|
194
|
-
let
|
|
194
|
+
let B;
|
|
195
195
|
async function _t(t, e, i) {
|
|
196
196
|
for (const o of e ?? [])
|
|
197
197
|
if (!(t && (o.minZoom != null && o.minZoom > t[0] || o.maxZoom != null && o.maxZoom < t[0]))) {
|
|
198
198
|
if (o.type === "fixed")
|
|
199
199
|
return o.coordinates.join(",");
|
|
200
200
|
if (o.type === "client-geolocation")
|
|
201
|
-
if (
|
|
202
|
-
if (
|
|
203
|
-
return
|
|
201
|
+
if (B && o.cachedLocationExpiry && B.time + o.cachedLocationExpiry > Date.now()) {
|
|
202
|
+
if (B.coords)
|
|
203
|
+
return B.coords;
|
|
204
204
|
} else {
|
|
205
205
|
let s;
|
|
206
206
|
try {
|
|
@@ -219,7 +219,7 @@ async function _t(t, e, i) {
|
|
|
219
219
|
}), s;
|
|
220
220
|
} catch {
|
|
221
221
|
} finally {
|
|
222
|
-
o.cachedLocationExpiry && (
|
|
222
|
+
o.cachedLocationExpiry && (B = {
|
|
223
223
|
time: Date.now(),
|
|
224
224
|
coords: s
|
|
225
225
|
});
|
|
@@ -233,21 +233,21 @@ async function _t(t, e, i) {
|
|
|
233
233
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
var
|
|
236
|
+
const Lt = ".sprite-icon{align-self:center;justify-self:center;opacity:.75;background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:#e7edff}li.picked .secondary{color:#96a4c7;padding-left:4px}li.picked .line2{color:#96a4c7}li.selected{background-color:#f3f6ff;animation:backAndForth 5s linear infinite}li.selected .primary{color:#2b8bfb}li.selected .secondary{color:#a2adc7;padding-left:4px}li.selected .line2{color:#a2adc7}li>img{align-self:center;justify-self:center;opacity:.75}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:#aeb6c7;padding-left:4px}.line2{color:#aeb6c7}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
|
|
237
|
+
var $t = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Oe = (t) => {
|
|
238
238
|
throw TypeError(t);
|
|
239
|
-
},
|
|
239
|
+
}, L = (t, e, i, o) => {
|
|
240
240
|
for (var s = o > 1 ? void 0 : o ? It(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
241
241
|
(a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
|
|
242
|
-
return o && s &&
|
|
243
|
-
},
|
|
244
|
-
const
|
|
245
|
-
let C,
|
|
242
|
+
return o && s && $t(e, i, s), s;
|
|
243
|
+
}, Se = (t, e, i) => e.has(t) || Oe("Cannot " + i), f = (t, e, i) => (Se(t, e, "read from private field"), i ? i.call(t) : e.get(t)), Ft = (t, e, i) => e.has(t) ? Oe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), E = (t, e, i) => (Se(t, e, "access private method"), i), p, q, z, g, Me, Te, he, re;
|
|
244
|
+
const Ce = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Pe = Ce ? "@2x" : "", P = Ce ? 2 : 1;
|
|
245
|
+
let C, Ee, k = class extends O {
|
|
246
246
|
constructor() {
|
|
247
247
|
super(...arguments), Ft(this, p), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
248
248
|
}
|
|
249
249
|
willUpdate(t) {
|
|
250
|
-
t.has("feature") && f(this, p,
|
|
250
|
+
t.has("feature") && f(this, p, q) && (this.index = f(this, p, q).length, E(this, p, he).call(this));
|
|
251
251
|
}
|
|
252
252
|
render() {
|
|
253
253
|
return m`
|
|
@@ -265,19 +265,19 @@ let C, Ue, k = class extends M {
|
|
|
265
265
|
style=${Ke({
|
|
266
266
|
width: `${this.spriteIcon.width / P}px`,
|
|
267
267
|
height: `${this.spriteIcon.height / P}px`,
|
|
268
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
268
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Pe}.png)`,
|
|
269
269
|
backgroundPosition: `-${this.spriteIcon.x / P}px -${this.spriteIcon.y / P}px`,
|
|
270
270
|
backgroundSize: `${C.width / P}px ${C.height / P}px`
|
|
271
271
|
})}
|
|
272
272
|
title=${f(this, p, g)}
|
|
273
273
|
/>
|
|
274
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, p, g)} @error=${
|
|
274
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, p, g)} @error=${E(this, p, Te)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : f(this, p, z) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, p, g)} title=${f(this, p, g)} /> `}
|
|
275
275
|
|
|
276
276
|
<span class="texts">
|
|
277
277
|
<span>
|
|
278
278
|
<span class="primary"> ${f(this, p, z) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
279
279
|
|
|
280
|
-
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, p, z) ? m` <span class="secondary"> ${f(this, p, g)} </span> ` :
|
|
280
|
+
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, p, z) ? m` <span class="secondary"> ${f(this, p, g)} </span> ` : J}
|
|
281
281
|
</span>
|
|
282
282
|
|
|
283
283
|
<span class="line2"> ${f(this, p, z) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
@@ -287,7 +287,7 @@ let C, Ue, k = class extends M {
|
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
289
|
p = /* @__PURE__ */ new WeakSet();
|
|
290
|
-
|
|
290
|
+
q = function() {
|
|
291
291
|
return this.feature?.properties?.categories;
|
|
292
292
|
};
|
|
293
293
|
z = function() {
|
|
@@ -296,75 +296,75 @@ z = function() {
|
|
|
296
296
|
g = function() {
|
|
297
297
|
return this.feature?.properties?.categories?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
298
298
|
};
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
Me = function() {
|
|
300
|
+
Ee ??= fetch(`${this.iconsBaseUrl}sprite${Pe}.json`).then((t) => t.json()).then((t) => {
|
|
301
301
|
C = t;
|
|
302
302
|
}).catch(() => {
|
|
303
303
|
C = null;
|
|
304
304
|
});
|
|
305
305
|
};
|
|
306
|
-
|
|
307
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
306
|
+
Te = function() {
|
|
307
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), E(this, p, he).call(this);
|
|
308
308
|
};
|
|
309
|
-
|
|
310
|
-
C !== void 0 ?
|
|
311
|
-
|
|
309
|
+
he = function() {
|
|
310
|
+
C !== void 0 ? E(this, p, re).call(this) : (E(this, p, Me).call(this), Ee?.then(() => {
|
|
311
|
+
E(this, p, re).call(this);
|
|
312
312
|
}));
|
|
313
313
|
};
|
|
314
|
-
|
|
314
|
+
re = function() {
|
|
315
315
|
do {
|
|
316
|
-
if (this.index--, this.category = f(this, p,
|
|
316
|
+
if (this.index--, this.category = f(this, p, q)?.[this.index], this.spriteIcon = this.category ? C?.icons[this.category] : void 0, this.spriteIcon)
|
|
317
317
|
break;
|
|
318
318
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
319
319
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
320
320
|
};
|
|
321
321
|
k.styles = F`
|
|
322
|
-
${
|
|
322
|
+
${ce(Lt)}
|
|
323
323
|
`;
|
|
324
|
-
|
|
324
|
+
L([
|
|
325
325
|
d({ type: Object })
|
|
326
326
|
], k.prototype, "feature", 2);
|
|
327
|
-
|
|
327
|
+
L([
|
|
328
328
|
d({ type: String })
|
|
329
329
|
], k.prototype, "itemStyle", 2);
|
|
330
|
-
|
|
330
|
+
L([
|
|
331
331
|
d({ type: String })
|
|
332
332
|
], k.prototype, "showPlaceType", 2);
|
|
333
|
-
|
|
333
|
+
L([
|
|
334
334
|
d({ attribute: !1 })
|
|
335
335
|
], k.prototype, "missingIconsCache", 2);
|
|
336
|
-
|
|
336
|
+
L([
|
|
337
337
|
d({ type: String })
|
|
338
338
|
], k.prototype, "iconsBaseUrl", 2);
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
L([
|
|
340
|
+
b()
|
|
341
341
|
], k.prototype, "category", 2);
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
L([
|
|
343
|
+
b()
|
|
344
344
|
], k.prototype, "imageUrl", 2);
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
L([
|
|
346
|
+
b()
|
|
347
347
|
], k.prototype, "spriteIcon", 2);
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
L([
|
|
349
|
+
b()
|
|
350
350
|
], k.prototype, "index", 2);
|
|
351
|
-
k =
|
|
351
|
+
k = L([
|
|
352
352
|
S("maptiler-geocoder-feature-item")
|
|
353
353
|
], k);
|
|
354
|
-
const
|
|
355
|
-
var St = Object.defineProperty,
|
|
354
|
+
const Ot = "form{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;margin:0;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text: #444952;--color-icon-button: #444952;pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:29px}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form{width:270px;max-width:270px}form:focus-within,form:hover{width:270px;max-width:270px}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul,div.error,div.no-results{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error,div.no-results{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error div{flex-grow:1}div.error maptiler-geocode-fail-icon{flex-shrink:0;width:20px;height:20px}div.error button{flex-shrink:0}div.error button maptiler-geocode-clear-icon{--color-icon-button: #e25041}div.error button:hover maptiler-geocode-clear-icon,div.error button:active maptiler-geocode-clear-icon{--color-icon-button: inherit}div.no-results{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results maptiler-geocode-fail-icon{margin-top:4px;flex-shrink:0;width:20px;height:20px}ul.options.open-on-top{top:auto;bottom:calc(100% + 6px)}button{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button:hover{background-color:transparent}button:hover,button:active{--color-icon-button: #2b8bfb}.input-group{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group:focus-within{outline:#2b8bfb solid 2px}.search-button{flex-shrink:0}.clear-button-container{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable{display:flex;flex-shrink:0}:host(.maptiler-geocoder):not(:empty){box-shadow:none}:host(.maptiler-geocoder) .input-group{border:white solid 2px}:host(.maptiler-geocoder) .input-group:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}:host(.maptiler-geocoder) form.can-collapse{max-width:33px}:host(.maptiler-geocoder) form,:host(.maptiler-geocoder) form:focus-within,:host(.maptiler-geocoder) form:hover{width:270px;max-width:270px}:host(.leaflet-geocoder) .input-group{border:white solid 1px}:host(.leaflet-geocoder) form.can-collapse{max-width:30px}";
|
|
355
|
+
var St = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Ue = (t) => {
|
|
356
356
|
throw TypeError(t);
|
|
357
357
|
}, c = (t, e, i, o) => {
|
|
358
|
-
for (var s = o > 1 ? void 0 : o ?
|
|
358
|
+
for (var s = o > 1 ? void 0 : o ? Mt(e, i) : e, r = t.length - 1, a; r >= 0; r--)
|
|
359
359
|
(a = t[r]) && (s = (o ? a(e, i, s) : a(s)) || s);
|
|
360
360
|
return o && s && St(e, i, s), s;
|
|
361
|
-
},
|
|
362
|
-
let l = class extends
|
|
361
|
+
}, de = (t, e, i) => e.has(t) || Ue("Cannot " + i), w = (t, e, i) => (de(t, e, "read from private field"), i ? i.call(t) : e.get(t)), G = (t, e, i) => e.has(t) ? Ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), oe = (t, e, i, o) => (de(t, e, "write to private field"), e.set(t, i), i), h = (t, e, i) => (de(t, e, "access private method"), i), Z, j, ae, R, n, N, Be, pe, x, ue, Q, fe, me, I, ge, K, Ge, ne, ze, je, Re, We, Ae, Ve, De;
|
|
362
|
+
let l = class extends O {
|
|
363
363
|
constructor() {
|
|
364
|
-
super(...arguments),
|
|
364
|
+
super(...arguments), G(this, n), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, G(this, Z, !1), G(this, j), G(this, ae, /* @__PURE__ */ new Set()), G(this, R);
|
|
365
365
|
}
|
|
366
366
|
firstUpdated() {
|
|
367
|
-
|
|
367
|
+
oe(this, Z, !0);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
370
|
* Set the options of this instance.
|
|
@@ -383,7 +383,7 @@ let l = class extends M {
|
|
|
383
383
|
* @param value text to set
|
|
384
384
|
*/
|
|
385
385
|
setQuery(t) {
|
|
386
|
-
h(this, n,
|
|
386
|
+
h(this, n, me).call(this, t, { external: !0 }), h(this, n, fe).call(this);
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
389
|
* Set the content of search input box and immediately submit it.
|
|
@@ -391,7 +391,7 @@ let l = class extends M {
|
|
|
391
391
|
* @param value text to set and submit
|
|
392
392
|
*/
|
|
393
393
|
submitQuery(t) {
|
|
394
|
-
h(this, n,
|
|
394
|
+
h(this, n, ge).call(this, t, { external: !0 });
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
397
397
|
* Clear search result list.
|
|
@@ -421,27 +421,25 @@ let l = class extends M {
|
|
|
421
421
|
}
|
|
422
422
|
/** @internal */
|
|
423
423
|
handleMapChange(t) {
|
|
424
|
-
|
|
424
|
+
oe(this, R, t);
|
|
425
425
|
}
|
|
426
426
|
/** @internal */
|
|
427
427
|
handleMapClick(t) {
|
|
428
|
-
this.reverseActive && h(this, n,
|
|
428
|
+
this.reverseActive && h(this, n, Ge).call(this, t);
|
|
429
429
|
}
|
|
430
430
|
willUpdate(t) {
|
|
431
|
-
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) &&
|
|
432
|
-
this.focusedDelayed = this.focused, this.clearOnBlur && !this.focused && (this.searchValue = "");
|
|
433
|
-
}, 100), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: b(this, n, K) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, H).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
431
|
+
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick && h(this, n, I).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && w(this, n, pe) && (h(this, n, I).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && h(this, n, x).call(this, "select", { feature: w(this, n, N) }), ["picked"].some((e) => t.has(e)) && this.picked && this.picked.id !== t.get("picked")?.id && (this.fetchFullGeometryOnPick && !this.picked.address && this.picked.geometry.type === "Point" && this.picked.place_type[0] !== "reverse" ? h(this, n, K).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
434
432
|
() => {
|
|
435
433
|
h(this, n, x).call(this, "pick", { feature: this.picked });
|
|
436
434
|
},
|
|
437
435
|
(e) => {
|
|
438
436
|
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, h(this, n, x).call(this, "pick", { feature: this.picked }));
|
|
439
437
|
}
|
|
440
|
-
), ["listFeatures", "
|
|
438
|
+
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ? h(this, n, x).call(this, "featuresshow") : h(this, n, x).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && h(this, n, x).call(this, "reversetoggle", { reverse: this.reverseActive });
|
|
441
439
|
}
|
|
442
440
|
render() {
|
|
443
441
|
return m`
|
|
444
|
-
<form @submit=${h(this, n,
|
|
442
|
+
<form @submit=${h(this, n, ue)} class=${V({ "can-collapse": this.collapsed && this.searchValue === "" })}>
|
|
445
443
|
<div class="input-group">
|
|
446
444
|
<button
|
|
447
445
|
class="search-button"
|
|
@@ -458,16 +456,16 @@ let l = class extends M {
|
|
|
458
456
|
@focus=${() => this.focused = !0}
|
|
459
457
|
@blur=${() => this.focused = !1}
|
|
460
458
|
@click=${() => this.focused = !0}
|
|
461
|
-
@keydown=${h(this, n,
|
|
462
|
-
@input=${h(this, n,
|
|
459
|
+
@keydown=${h(this, n, ne)}
|
|
460
|
+
@input=${h(this, n, ze)}
|
|
463
461
|
@change=${() => this.picked = void 0}
|
|
464
462
|
placeholder=${this.placeholder ?? "Search"}
|
|
465
463
|
aria-label=${this.placeholder ?? "Search"}
|
|
466
464
|
/>
|
|
467
465
|
|
|
468
466
|
<div class="clear-button-container ${V({ displayable: this.searchValue !== "" })}">
|
|
469
|
-
${
|
|
470
|
-
<button type="button" @click=${h(this, n,
|
|
467
|
+
${w(this, n, Be) ? m`<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>` : m`
|
|
468
|
+
<button type="button" @click=${h(this, n, De)} title=${this.clearButtonTitle ?? "clear"}>
|
|
471
469
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
472
470
|
</button>
|
|
473
471
|
`}
|
|
@@ -482,7 +480,7 @@ let l = class extends M {
|
|
|
482
480
|
>
|
|
483
481
|
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
484
482
|
</button>
|
|
485
|
-
` :
|
|
483
|
+
` : J}
|
|
486
484
|
|
|
487
485
|
<!-- <slot /> -->
|
|
488
486
|
</div>
|
|
@@ -497,7 +495,7 @@ let l = class extends M {
|
|
|
497
495
|
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
498
496
|
</button>
|
|
499
497
|
</div>
|
|
500
|
-
` : !this.
|
|
498
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? J : this.listFeatures.length === 0 ? m`
|
|
501
499
|
<div class="no-results">
|
|
502
500
|
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
503
501
|
|
|
@@ -506,7 +504,14 @@ let l = class extends M {
|
|
|
506
504
|
</div>
|
|
507
505
|
</div>
|
|
508
506
|
` : m`
|
|
509
|
-
<ul
|
|
507
|
+
<ul
|
|
508
|
+
class="options ${V({ "open-on-top": this.openListOnTop })}"
|
|
509
|
+
@pointerleave=${h(this, n, We)}
|
|
510
|
+
@pointerdown=${h(this, n, Ae)}
|
|
511
|
+
@pointerup=${h(this, n, Ve)}
|
|
512
|
+
@keydown=${h(this, n, ne)}
|
|
513
|
+
role="listbox"
|
|
514
|
+
>
|
|
510
515
|
${Qe(
|
|
511
516
|
this.listFeatures,
|
|
512
517
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
@@ -515,17 +520,15 @@ let l = class extends M {
|
|
|
515
520
|
.feature=${t}
|
|
516
521
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
517
522
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
518
|
-
@
|
|
519
|
-
h(this, n,
|
|
523
|
+
@pointerenter=${() => {
|
|
524
|
+
h(this, n, Re).call(this, e);
|
|
520
525
|
}}
|
|
521
526
|
@select=${() => {
|
|
522
|
-
h(this, n,
|
|
527
|
+
h(this, n, je).call(this, t);
|
|
523
528
|
}}
|
|
524
|
-
.missingIconsCache=${
|
|
525
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
526
|
-
|
|
527
|
-
${t.place_name}
|
|
528
|
-
</maptiler-geocoder-feature-item>
|
|
529
|
+
.missingIconsCache=${w(this, ae)}
|
|
530
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.8/icons/"}
|
|
531
|
+
/>
|
|
529
532
|
`
|
|
530
533
|
)}
|
|
531
534
|
</ul>
|
|
@@ -534,26 +537,22 @@ let l = class extends M {
|
|
|
534
537
|
`;
|
|
535
538
|
}
|
|
536
539
|
};
|
|
537
|
-
|
|
538
|
-
q = /* @__PURE__ */ new WeakMap();
|
|
540
|
+
Z = /* @__PURE__ */ new WeakMap();
|
|
539
541
|
j = /* @__PURE__ */ new WeakMap();
|
|
540
|
-
|
|
542
|
+
ae = /* @__PURE__ */ new WeakMap();
|
|
541
543
|
R = /* @__PURE__ */ new WeakMap();
|
|
542
544
|
n = /* @__PURE__ */ new WeakSet();
|
|
543
|
-
|
|
545
|
+
N = function() {
|
|
544
546
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
545
547
|
};
|
|
546
|
-
|
|
547
|
-
return !!this.listFeatures?.length && (this.focusedDelayed || this.keepListOpen);
|
|
548
|
-
};
|
|
549
|
-
ze = function() {
|
|
548
|
+
Be = function() {
|
|
550
549
|
return this.abortController !== void 0;
|
|
551
550
|
};
|
|
552
|
-
|
|
551
|
+
pe = function() {
|
|
553
552
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
554
553
|
};
|
|
555
554
|
x = function(t, ...[e]) {
|
|
556
|
-
|
|
555
|
+
w(this, Z) && this.dispatchEvent(
|
|
557
556
|
new CustomEvent(t, {
|
|
558
557
|
bubbles: !0,
|
|
559
558
|
composed: !0,
|
|
@@ -561,30 +560,30 @@ x = function(t, ...[e]) {
|
|
|
561
560
|
})
|
|
562
561
|
);
|
|
563
562
|
};
|
|
564
|
-
|
|
565
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
563
|
+
ue = function(t, { external: e = !1 } = {}) {
|
|
564
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(w(this, j)), this.selectedItemIndex > -1 && this.listFeatures ? (this.picked = this.listFeatures[this.selectedItemIndex], this.searchValue = this.picked.place_type[0] === "reverse" ? this.picked.place_name : this.picked.place_name.replace(/,.*/, ""), this.error = void 0, this.selectedItemIndex = -1) : this.searchValue && h(this, n, K).call(this, this.searchValue, { exact: !0, external: e }).then(() => {
|
|
566
565
|
this.picked = void 0;
|
|
567
|
-
}).catch((
|
|
566
|
+
}).catch((i) => this.error = i);
|
|
568
567
|
};
|
|
569
|
-
|
|
568
|
+
Q = function(t) {
|
|
570
569
|
try {
|
|
571
570
|
return Ne(t, 6);
|
|
572
571
|
} catch {
|
|
573
572
|
return !1;
|
|
574
573
|
}
|
|
575
574
|
};
|
|
576
|
-
|
|
575
|
+
fe = function() {
|
|
577
576
|
setTimeout(() => {
|
|
578
577
|
this.input.focus(), this.focused = !0, this.input.select();
|
|
579
578
|
});
|
|
580
579
|
};
|
|
581
|
-
|
|
582
|
-
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n,
|
|
583
|
-
if (clearTimeout(
|
|
580
|
+
me = function(t, { external: e = !1 } = {}) {
|
|
581
|
+
if (this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Q).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
582
|
+
if (clearTimeout(w(this, j)), w(this, n, pe))
|
|
584
583
|
return;
|
|
585
584
|
const i = this.searchValue;
|
|
586
|
-
|
|
587
|
-
h(this, n,
|
|
585
|
+
oe(this, j, window.setTimeout(() => {
|
|
586
|
+
h(this, n, K).call(this, i, { external: e }).catch((o) => this.error = o);
|
|
588
587
|
}, this.debounceSearch ?? 200));
|
|
589
588
|
} else
|
|
590
589
|
h(this, n, I).call(this);
|
|
@@ -592,53 +591,53 @@ ge = function(t, { external: e = !1 } = {}) {
|
|
|
592
591
|
I = function() {
|
|
593
592
|
this.listFeatures !== void 0 && (this.listFeatures = void 0, h(this, n, x).call(this, "featuresclear"));
|
|
594
593
|
};
|
|
595
|
-
|
|
596
|
-
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n,
|
|
594
|
+
ge = function(t, { external: e = !1 } = {}) {
|
|
595
|
+
this.searchValue = t, h(this, n, x).call(this, "querychange", { query: this.searchValue, reverseCoords: h(this, n, Q).call(this, t) }), this.selectedItemIndex = -1, h(this, n, ue).call(this, void 0, { external: e });
|
|
597
596
|
};
|
|
598
|
-
|
|
597
|
+
K = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
599
598
|
this.error = void 0, this.abortController?.abort();
|
|
600
599
|
const s = new AbortController();
|
|
601
600
|
this.abortController = s;
|
|
602
601
|
try {
|
|
603
|
-
const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", a = h(this, n,
|
|
602
|
+
const r = this.apiUrl ?? "https://api.maptiler.com/geocoding", a = h(this, n, Q).call(this, t), u = new URL(r + "/" + encodeURIComponent(a ? `${a.decimalLongitude},${a.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
604
603
|
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
605
|
-
const [
|
|
604
|
+
const [M] = w(this, R) ?? [void 0];
|
|
606
605
|
let _ = (!a || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
607
|
-
(v) => typeof v == "string" ? v :
|
|
606
|
+
(v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
608
607
|
).filter((v) => v !== void 0);
|
|
609
608
|
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
const v = this.proximity ?? [{ type: "server-geolocation" }],
|
|
613
|
-
|
|
609
|
+
const ye = !a || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
610
|
+
if (ye && y.set("excludeTypes", String(ye)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !a) {
|
|
611
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], xe = await _t(w(this, R), v, s);
|
|
612
|
+
xe && y.set("proximity", xe), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
614
613
|
}
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
const qe = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true",
|
|
618
|
-
if (
|
|
619
|
-
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 !==
|
|
614
|
+
const ve = this.limit ?? 5, Y = this.reverseGeocodingLimit ?? ve;
|
|
615
|
+
Y > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), a ? (Y === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(Y)) : y.set("limit", String(ve)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
616
|
+
const qe = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", A = u.toString();
|
|
617
|
+
if (A === this.lastSearchUrl) {
|
|
618
|
+
e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1));
|
|
620
619
|
return;
|
|
621
620
|
}
|
|
622
|
-
h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl =
|
|
623
|
-
let
|
|
621
|
+
h(this, n, x).call(this, "request", { urlObj: u }), this.lastSearchUrl = A;
|
|
622
|
+
let U;
|
|
624
623
|
if (qe)
|
|
625
|
-
|
|
624
|
+
U = { type: "FeatureCollection", features: [] };
|
|
626
625
|
else {
|
|
627
|
-
const v = await fetch(
|
|
626
|
+
const v = await fetch(A, {
|
|
628
627
|
signal: s.signal,
|
|
629
628
|
...this.fetchParameters
|
|
630
629
|
});
|
|
631
630
|
if (!v.ok)
|
|
632
631
|
throw new Error(await v.text());
|
|
633
|
-
|
|
632
|
+
U = await v.json();
|
|
634
633
|
}
|
|
635
|
-
h(this, n, x).call(this, "response", { url:
|
|
634
|
+
h(this, n, x).call(this, "response", { url: A, featureCollection: U }), e ? (this.clearListOnPick && h(this, n, I).call(this), this.picked = U.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = U.features.filter(this.filter ?? (() => !0)), a && this.listFeatures.unshift({
|
|
636
635
|
type: "Feature",
|
|
637
636
|
properties: {},
|
|
638
637
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
639
638
|
id: `reverse_${a.decimalLongitude}_${a.decimalLatitude}`,
|
|
640
|
-
|
|
641
|
-
|
|
639
|
+
place_name: `${a.decimalLatitude}, ${a.decimalLongitude}`,
|
|
640
|
+
text: a.toCoordinateFormat("DMS"),
|
|
642
641
|
/* eslint-enable @typescript-eslint/restrict-template-expressions */
|
|
643
642
|
place_type: ["reverse"],
|
|
644
643
|
place_type_name: ["reverse"],
|
|
@@ -648,7 +647,7 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
|
648
647
|
type: "Point",
|
|
649
648
|
coordinates: [a.decimalLongitude, a.decimalLatitude]
|
|
650
649
|
}
|
|
651
|
-
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !==
|
|
650
|
+
}), h(this, n, x).call(this, "featureslisted", { features: this.listFeatures, external: o }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== w(this, n, N)?.id && (this.selectedItemIndex = -1), a && this.input.focus());
|
|
652
651
|
} catch (r) {
|
|
653
652
|
if (r && typeof r == "object" && "name" in r && r.name === "AbortError")
|
|
654
653
|
return;
|
|
@@ -657,32 +656,40 @@ H = async function(t, { byId: e = !1, exact: i = !1, external: o = !1 } = {}) {
|
|
|
657
656
|
s === this.abortController && (this.abortController = void 0);
|
|
658
657
|
}
|
|
659
658
|
};
|
|
660
|
-
|
|
661
|
-
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n,
|
|
659
|
+
Ge = function(t) {
|
|
660
|
+
this.reverseActive = this.enableReverse === "always", h(this, n, I).call(this), this.picked = void 0, h(this, n, ge).call(this, `${t[1].toFixed(6)}, ${kt(t[0], [-180, 180], !0).toFixed(6)}`), h(this, n, fe).call(this);
|
|
662
661
|
};
|
|
663
|
-
|
|
662
|
+
ne = function(t) {
|
|
664
663
|
if (!this.listFeatures)
|
|
665
664
|
return;
|
|
666
665
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
667
666
|
e && (this.input.focus(), this.focused = !0, t.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
|
|
668
667
|
};
|
|
669
|
-
|
|
670
|
-
h(this, n,
|
|
668
|
+
ze = function(t) {
|
|
669
|
+
h(this, n, me).call(this, t.target.value);
|
|
671
670
|
};
|
|
672
|
-
|
|
671
|
+
je = function(t) {
|
|
673
672
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
674
673
|
};
|
|
675
|
-
|
|
674
|
+
Re = function(t) {
|
|
676
675
|
this.selectedItemIndex = t;
|
|
677
676
|
};
|
|
677
|
+
We = function() {
|
|
678
|
+
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
679
|
+
};
|
|
680
|
+
Ae = function() {
|
|
681
|
+
this.isFeatureListInteractedWith = !0;
|
|
682
|
+
};
|
|
678
683
|
Ve = function() {
|
|
679
|
-
(
|
|
684
|
+
setTimeout(() => {
|
|
685
|
+
this.isFeatureListInteractedWith = !1;
|
|
686
|
+
});
|
|
680
687
|
};
|
|
681
|
-
|
|
688
|
+
De = function() {
|
|
682
689
|
this.searchValue = "", h(this, n, x).call(this, "queryclear"), this.picked = void 0, this.input.focus();
|
|
683
690
|
};
|
|
684
691
|
l.styles = F`
|
|
685
|
-
${
|
|
692
|
+
${ce(Ot)}
|
|
686
693
|
`;
|
|
687
694
|
c([
|
|
688
695
|
d({ attribute: !1 })
|
|
@@ -799,35 +806,38 @@ c([
|
|
|
799
806
|
Ze("input")
|
|
800
807
|
], l.prototype, "input", 2);
|
|
801
808
|
c([
|
|
802
|
-
|
|
809
|
+
b()
|
|
803
810
|
], l.prototype, "searchValue", 2);
|
|
804
811
|
c([
|
|
805
|
-
|
|
812
|
+
b()
|
|
806
813
|
], l.prototype, "listFeatures", 2);
|
|
807
814
|
c([
|
|
808
|
-
|
|
815
|
+
b()
|
|
809
816
|
], l.prototype, "selectedItemIndex", 2);
|
|
810
817
|
c([
|
|
811
|
-
|
|
818
|
+
b()
|
|
812
819
|
], l.prototype, "picked", 2);
|
|
813
820
|
c([
|
|
814
|
-
|
|
821
|
+
b()
|
|
815
822
|
], l.prototype, "cachedFeatures", 2);
|
|
816
823
|
c([
|
|
817
|
-
|
|
824
|
+
b()
|
|
818
825
|
], l.prototype, "lastSearchUrl", 2);
|
|
819
826
|
c([
|
|
820
|
-
|
|
827
|
+
b()
|
|
821
828
|
], l.prototype, "error", 2);
|
|
822
829
|
c([
|
|
823
|
-
|
|
830
|
+
b()
|
|
824
831
|
], l.prototype, "abortController", 2);
|
|
825
832
|
c([
|
|
826
|
-
|
|
833
|
+
b()
|
|
827
834
|
], l.prototype, "focused", 2);
|
|
828
835
|
c([
|
|
829
|
-
|
|
830
|
-
], l.prototype, "
|
|
836
|
+
b()
|
|
837
|
+
], l.prototype, "isFeatureListVisible", 2);
|
|
838
|
+
c([
|
|
839
|
+
b()
|
|
840
|
+
], l.prototype, "isFeatureListInteractedWith", 2);
|
|
831
841
|
l = c([
|
|
832
842
|
S("maptiler-geocoder")
|
|
833
843
|
], l);
|
|
@@ -875,9 +885,9 @@ var Pt = Object.getOwnPropertyDescriptor, Et = (t, e, i, o) => {
|
|
|
875
885
|
(a = t[r]) && (s = a(s) || s);
|
|
876
886
|
return s;
|
|
877
887
|
};
|
|
878
|
-
let
|
|
888
|
+
let le = class extends O {
|
|
879
889
|
render() {
|
|
880
|
-
return
|
|
890
|
+
return W`
|
|
881
891
|
<svg
|
|
882
892
|
viewBox="0 0 70 85"
|
|
883
893
|
fill="none"
|
|
@@ -891,15 +901,15 @@ let ce = class extends M {
|
|
|
891
901
|
`;
|
|
892
902
|
}
|
|
893
903
|
};
|
|
894
|
-
|
|
895
|
-
${
|
|
904
|
+
le.styles = F`
|
|
905
|
+
${ce(Ct)}
|
|
896
906
|
`;
|
|
897
|
-
|
|
907
|
+
le = Et([
|
|
898
908
|
S("maptiler-geocode-marker")
|
|
899
|
-
],
|
|
909
|
+
], le);
|
|
900
910
|
function Ut(t) {
|
|
901
911
|
const e = ot(
|
|
902
|
-
|
|
912
|
+
$e([
|
|
903
913
|
nt([
|
|
904
914
|
[
|
|
905
915
|
[180, 90],
|
|
@@ -915,20 +925,20 @@ function Ut(t) {
|
|
|
915
925
|
if (!e)
|
|
916
926
|
return;
|
|
917
927
|
e.properties = { isMask: !0 };
|
|
918
|
-
const i =
|
|
928
|
+
const i = D(Le(t)), o = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, r = i[2] > 180, a = at(t);
|
|
919
929
|
if (a.features.length > 1 && (s || r))
|
|
920
930
|
for (const u of a.features) {
|
|
921
|
-
const y =
|
|
931
|
+
const y = D(Le(u));
|
|
922
932
|
if (r && y[0] < -180 + o)
|
|
923
|
-
for (const
|
|
924
|
-
for (const _ of
|
|
933
|
+
for (const M of u.geometry.coordinates)
|
|
934
|
+
for (const _ of M)
|
|
925
935
|
_[0] += 360 - o;
|
|
926
936
|
if (s && y[2] > 180 - o)
|
|
927
|
-
for (const
|
|
928
|
-
for (const _ of
|
|
937
|
+
for (const M of u.geometry.coordinates)
|
|
938
|
+
for (const _ of M)
|
|
929
939
|
_[0] -= 360 - o;
|
|
930
940
|
}
|
|
931
|
-
return
|
|
941
|
+
return $e([a.features.length < 2 ? t : lt(a) ?? t, e]);
|
|
932
942
|
}
|
|
933
943
|
const Bt = {
|
|
934
944
|
continental_marine: 4,
|
|
@@ -955,15 +965,15 @@ const Bt = {
|
|
|
955
965
|
"poi.aerodrome": 13
|
|
956
966
|
// TODO add many more
|
|
957
967
|
}, Gt = (t) => (e) => {
|
|
958
|
-
const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
968
|
+
const i = t.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.8/icons/", o = e.getProperties(), s = e.getGeometry()?.getType(), r = o.isMask ? 0 : s === "LineString" || s === "MultiLineString" ? 3 : 2;
|
|
959
969
|
return new ht({
|
|
960
|
-
stroke: o.isMask ? void 0 : new
|
|
970
|
+
stroke: o.isMask ? void 0 : new Fe({
|
|
961
971
|
color: "#3170fe",
|
|
962
972
|
lineDash: [r, r],
|
|
963
973
|
width: r,
|
|
964
974
|
lineCap: "butt"
|
|
965
975
|
}),
|
|
966
|
-
fill: o.isMask ? new
|
|
976
|
+
fill: o.isMask ? new Ie({
|
|
967
977
|
color: "#00000020"
|
|
968
978
|
}) : void 0,
|
|
969
979
|
image: new ct({
|
|
@@ -972,10 +982,10 @@ const Bt = {
|
|
|
972
982
|
}),
|
|
973
983
|
zIndex: o.isSelected ? 2 : o.isReverse ? 0 : 1,
|
|
974
984
|
text: (o.isSelected || o.isMouseOver) && o.tooltip ? new dt({
|
|
975
|
-
backgroundFill: new
|
|
985
|
+
backgroundFill: new Ie({ color: "white" }),
|
|
976
986
|
text: o.tooltip,
|
|
977
987
|
offsetY: -40,
|
|
978
|
-
backgroundStroke: new
|
|
988
|
+
backgroundStroke: new Fe({
|
|
979
989
|
color: "white",
|
|
980
990
|
lineJoin: "round",
|
|
981
991
|
width: 3
|
|
@@ -997,7 +1007,7 @@ class li extends Ye {
|
|
|
997
1007
|
}
|
|
998
1008
|
/** @internal Not to be called directly */
|
|
999
1009
|
setMap(e) {
|
|
1000
|
-
super.setMap(e), this.#t && this.#t !== e && (this.#I(), this.#P(), this.#t = void 0), e && (this.#t = e, this
|
|
1010
|
+
super.setMap(e), this.#t && this.#t !== e && (this.#I(), this.#P(), this.#t = void 0), e && (this.#t = e, this.#$(), this.#C());
|
|
1001
1011
|
}
|
|
1002
1012
|
getOptions() {
|
|
1003
1013
|
return { ...this.#e };
|
|
@@ -1038,6 +1048,7 @@ class li extends Ye {
|
|
|
1038
1048
|
#g;
|
|
1039
1049
|
/** Layer used for showing results */
|
|
1040
1050
|
#l;
|
|
1051
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1041
1052
|
/** Source connected to layer used for showing results */
|
|
1042
1053
|
#s;
|
|
1043
1054
|
/** Last marker the mouse was over, used to detech mouseover and mouseleave events on markers */
|
|
@@ -1077,7 +1088,7 @@ class li extends Ye {
|
|
|
1077
1088
|
},
|
|
1078
1089
|
featureslisted: (e) => {
|
|
1079
1090
|
const i = e.detail.features;
|
|
1080
|
-
this.#a = i, this.#u(this.#a, void 0), this.#
|
|
1091
|
+
this.#a = i, this.#u(this.#a, void 0), this.#O(e), this.#i("featureslisted", e.detail);
|
|
1081
1092
|
},
|
|
1082
1093
|
featuresclear: () => {
|
|
1083
1094
|
this.#a = void 0, this.#u(void 0, void 0), this.#i("featuresclear");
|
|
@@ -1092,10 +1103,10 @@ class li extends Ye {
|
|
|
1092
1103
|
#x = {
|
|
1093
1104
|
postrender: () => {
|
|
1094
1105
|
const e = this.#t?.getView().getZoom(), i = this.#t?.getView().getCenter();
|
|
1095
|
-
this.#r.handleMapChange(e && i ? [e, ...this
|
|
1106
|
+
this.#r.handleMapChange(e && i ? [e, ...this.#L(i)] : void 0);
|
|
1096
1107
|
},
|
|
1097
1108
|
click: (e) => {
|
|
1098
|
-
this.#r.handleMapClick(this
|
|
1109
|
+
this.#r.handleMapClick(this.#L(e.coordinate)), this.#t?.forEachFeatureAtPixel(e.pixel, (i) => {
|
|
1099
1110
|
const o = i.getId(), s = this.#a?.find((r) => r.id === o);
|
|
1100
1111
|
if (!(!o || !s))
|
|
1101
1112
|
return e.stopPropagation(), this.#i("markerclick", { feature: s, marker: i }), !0;
|
|
@@ -1122,7 +1133,7 @@ class li extends Ye {
|
|
|
1122
1133
|
#b() {
|
|
1123
1134
|
this.#r.setOptions(this.#e), this.#r.fetchFullGeometryOnPick = this.#e.pickedResultStyle !== "marker-only";
|
|
1124
1135
|
}
|
|
1125
|
-
|
|
1136
|
+
#$() {
|
|
1126
1137
|
if (this.#t) {
|
|
1127
1138
|
for (const [e, i] of Object.entries(this.#v))
|
|
1128
1139
|
this.#r.addEventListener(e, i);
|
|
@@ -1142,16 +1153,16 @@ class li extends Ye {
|
|
|
1142
1153
|
this.dispatchEvent(Object.assign(new He(e), i));
|
|
1143
1154
|
}
|
|
1144
1155
|
#F(e) {
|
|
1145
|
-
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#w(e.center, this.#p(e)) : this.#k(
|
|
1156
|
+
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#w(e.center, this.#p(e)) : this.#k(D(e.bbox), 50, this.#p(e));
|
|
1146
1157
|
}
|
|
1147
|
-
#
|
|
1158
|
+
#O({ detail: { features: e, external: i } }) {
|
|
1148
1159
|
if (!e || e.length === 0 || !this.#m || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
|
|
1149
1160
|
return;
|
|
1150
1161
|
const o = e.every((a) => a.matching_text), s = e.reduce(
|
|
1151
1162
|
(a, u) => o || !u.matching_text ? [Math.min(a[0], u.bbox[0]), Math.min(a[1], u.bbox[1]), Math.max(a[2], u.bbox[2]), Math.max(a[3], u.bbox[3])] : a,
|
|
1152
1163
|
[180, 90, -180, -90]
|
|
1153
1164
|
), r = e.map((a) => this.#p(a)).filter((a) => a !== void 0).reduce((a, u) => a === void 0 ? u : Math.max(a, u), void 0);
|
|
1154
|
-
this.#k(
|
|
1165
|
+
this.#k(D(s), 50, r);
|
|
1155
1166
|
}
|
|
1156
1167
|
#p(e) {
|
|
1157
1168
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
@@ -1168,7 +1179,7 @@ class li extends Ye {
|
|
|
1168
1179
|
get #S() {
|
|
1169
1180
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1170
1181
|
}
|
|
1171
|
-
get #
|
|
1182
|
+
get #M() {
|
|
1172
1183
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1173
1184
|
}
|
|
1174
1185
|
#w(e, i) {
|
|
@@ -1184,7 +1195,7 @@ class li extends Ye {
|
|
|
1184
1195
|
padding: [i, i, i, i],
|
|
1185
1196
|
...o ? { maxZoom: o } : {},
|
|
1186
1197
|
duration: 2e3,
|
|
1187
|
-
...this.#
|
|
1198
|
+
...this.#M
|
|
1188
1199
|
});
|
|
1189
1200
|
}
|
|
1190
1201
|
#_(e) {
|
|
@@ -1196,7 +1207,7 @@ class li extends Ye {
|
|
|
1196
1207
|
}
|
|
1197
1208
|
const i = this.#f(e);
|
|
1198
1209
|
if (!this.#o) {
|
|
1199
|
-
this.#o = new
|
|
1210
|
+
this.#o = new $(new H(i)), this.#o.set("isReverse", !0), this.#s.addFeature(this.#o);
|
|
1200
1211
|
return;
|
|
1201
1212
|
}
|
|
1202
1213
|
this.#o.getGeometry().setCoordinates(i);
|
|
@@ -1207,35 +1218,35 @@ class li extends Ye {
|
|
|
1207
1218
|
this.#s.removeFeatures([...this.#c.values()]), this.#c = /* @__PURE__ */ new Map();
|
|
1208
1219
|
const o = () => {
|
|
1209
1220
|
if (!i || !this.#t || this.#e.marker === !1) return;
|
|
1210
|
-
const s = new
|
|
1221
|
+
const s = new $(new H(this.#f(i.center)));
|
|
1211
1222
|
s.setId(i.id), this.#c.set(i, s), this.#s?.addFeature(s);
|
|
1212
1223
|
};
|
|
1213
1224
|
if (i?.geometry.type === "GeometryCollection") {
|
|
1214
|
-
const s = i.geometry.geometries.map((r) => r.type === "Polygon" ? new
|
|
1225
|
+
const s = i.geometry.geometries.map((r) => r.type === "Polygon" ? new be(r.coordinates) : r.type === "MultiPolygon" ? new we(r.coordinates) : null).filter((r) => !!r);
|
|
1215
1226
|
if (s.length > 0)
|
|
1216
|
-
this.#s.addFeature(new
|
|
1227
|
+
this.#s.addFeature(new $(new Je(s).transform(T, this.#n())));
|
|
1217
1228
|
else
|
|
1218
1229
|
for (const r of i.geometry.geometries)
|
|
1219
|
-
r.type === "LineString" ? this.#s.addFeature(new
|
|
1230
|
+
r.type === "LineString" ? this.#s.addFeature(new $(new ke(r.coordinates).transform(T, this.#n()))) : r.type === "MultiLineString" && this.#s.addFeature(new $(new _e(r.coordinates).transform(T, this.#n())));
|
|
1220
1231
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1221
1232
|
const s = Ut(i);
|
|
1222
1233
|
if (s)
|
|
1223
1234
|
for (const r of s.features) {
|
|
1224
|
-
const a = r.geometry.type === "Polygon" ? new
|
|
1235
|
+
const a = r.geometry.type === "Polygon" ? new be(r.geometry.coordinates) : new we(r.geometry.coordinates);
|
|
1225
1236
|
this.#s.addFeature(
|
|
1226
|
-
new
|
|
1237
|
+
new $({
|
|
1227
1238
|
isMask: !!r.properties?.isMask,
|
|
1228
1239
|
geometry: a.transform(T, this.#n())
|
|
1229
1240
|
})
|
|
1230
1241
|
);
|
|
1231
1242
|
}
|
|
1232
1243
|
this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && o();
|
|
1233
|
-
} else i?.geometry.type === "LineString" ? this.#s.addFeature(new
|
|
1244
|
+
} else i?.geometry.type === "LineString" ? this.#s.addFeature(new $(new ke(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type === "MultiLineString" ? this.#s.addFeature(new $(new _e(i.geometry.coordinates).transform(T, this.#n()))) : i?.geometry.type.endsWith("Point") && o();
|
|
1234
1245
|
if (this.#e.showResultMarkers !== !1)
|
|
1235
1246
|
for (const s of e ?? []) {
|
|
1236
1247
|
if (s.id === i?.id || s.place_type.includes("reverse"))
|
|
1237
1248
|
continue;
|
|
1238
|
-
const r = new
|
|
1249
|
+
const r = new $(new H(this.#f(s.center)));
|
|
1239
1250
|
r.setId(s.id), r.setProperties({
|
|
1240
1251
|
fuzzy: !!s.matching_text,
|
|
1241
1252
|
tooltip: s.place_type[0] === "reverse" ? s.place_name : s.place_name.replace(/,.*/, "")
|
|
@@ -1259,7 +1270,7 @@ class li extends Ye {
|
|
|
1259
1270
|
#f(e) {
|
|
1260
1271
|
return it(e, this.#n());
|
|
1261
1272
|
}
|
|
1262
|
-
|
|
1273
|
+
#L(e) {
|
|
1263
1274
|
return st(e, this.#n());
|
|
1264
1275
|
}
|
|
1265
1276
|
#E() {
|
|
@@ -1272,12 +1283,12 @@ class li extends Ye {
|
|
|
1272
1283
|
export {
|
|
1273
1284
|
Gt as DEFAULT_GEOMETRY_STYLE,
|
|
1274
1285
|
li as GeocodingControl,
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1286
|
+
X as MaptilerGeocodeClearIconElement,
|
|
1287
|
+
ee as MaptilerGeocodeFailIconElement,
|
|
1288
|
+
te as MaptilerGeocodeLoadingIconElement,
|
|
1289
|
+
le as MaptilerGeocodeMarkerElement,
|
|
1290
|
+
ie as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1291
|
+
se as MaptilerGeocodeSearchIconElement,
|
|
1281
1292
|
l as MaptilerGeocoderElement,
|
|
1282
1293
|
li as OpenLayersGeocodingControl,
|
|
1283
1294
|
Bt as ZOOM_DEFAULTS
|