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