@maptiler/geocoding-control 3.0.0-rc.9 → 3.1.0-rc.1
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 +455 -383
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +118 -98
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.js +520 -448
- package/dist/leaflet.js.map +1 -1
- package/dist/leaflet.umd.js +121 -101
- package/dist/leaflet.umd.js.map +1 -1
- package/dist/maplibregl.js +455 -383
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +120 -100
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +477 -405
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +120 -100
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.js +610 -538
- package/dist/openlayers.js.map +1 -1
- package/dist/openlayers.umd.js +121 -101
- package/dist/openlayers.umd.js.map +1 -1
- package/dist/src/geocoder/geocoder.d.ts +14 -2
- package/package.json +6 -5
- package/check-version.js +0 -69
package/dist/maptilersdk.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { customElement as
|
|
3
|
-
import { convert as
|
|
4
|
-
import { classMap as
|
|
5
|
-
import { repeat as
|
|
1
|
+
import { css as O, LitElement as F, svg as D, html as m, unsafeCSS as ue, nothing as ie } from "lit";
|
|
2
|
+
import { customElement as T, property as p, state as x, queryAssignedElements as L } from "lit/decorators.js";
|
|
3
|
+
import { convert as Ye } from "geo-coordinates-parser";
|
|
4
|
+
import { classMap as q } from "lit/directives/class-map.js";
|
|
5
|
+
import { repeat as Je } from "lit/directives/repeat.js";
|
|
6
6
|
import "@turf/clone";
|
|
7
|
-
import { styleMap as
|
|
8
|
-
import { config as
|
|
9
|
-
import { featureCollection as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
7
|
+
import { styleMap as Xe } from "lit/directives/style-map.js";
|
|
8
|
+
import { config as et } from "@maptiler/sdk";
|
|
9
|
+
import { featureCollection as Z, polygon as tt, feature as it } from "@turf/helpers";
|
|
10
|
+
import Fe from "@turf/union";
|
|
11
|
+
import te from "maplibre-gl";
|
|
12
|
+
import Ie from "@turf/bbox";
|
|
13
|
+
import st from "@turf/difference";
|
|
14
|
+
import rt from "@turf/flatten";
|
|
15
|
+
var ot = Object.getOwnPropertyDescriptor, at = (t, e, i, a) => {
|
|
16
|
+
for (var s = a > 1 ? void 0 : a ? ot(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
17
17
|
(r = t[o]) && (s = r(s) || s);
|
|
18
18
|
return s;
|
|
19
19
|
};
|
|
20
|
-
let
|
|
20
|
+
let se = class extends F {
|
|
21
21
|
render() {
|
|
22
|
-
return
|
|
22
|
+
return D`
|
|
23
23
|
<svg viewBox="0 0 14 14" width="13" height="13">
|
|
24
24
|
<path
|
|
25
25
|
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"
|
|
@@ -28,23 +28,23 @@ let X = class extends F {
|
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
se.styles = O`
|
|
32
32
|
svg {
|
|
33
33
|
display: block;
|
|
34
|
-
fill: var(--color-icon-button);
|
|
34
|
+
fill: var(--color-icon-button, #444952);
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
],
|
|
40
|
-
var
|
|
41
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
37
|
+
se = at([
|
|
38
|
+
T("maptiler-geocode-clear-icon")
|
|
39
|
+
], se);
|
|
40
|
+
var lt = Object.getOwnPropertyDescriptor, nt = (t, e, i, a) => {
|
|
41
|
+
for (var s = a > 1 ? void 0 : a ? lt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
42
42
|
(r = t[o]) && (s = r(s) || s);
|
|
43
43
|
return s;
|
|
44
44
|
};
|
|
45
|
-
let
|
|
45
|
+
let re = class extends F {
|
|
46
46
|
render() {
|
|
47
|
-
return
|
|
47
|
+
return D`
|
|
48
48
|
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
49
49
|
<path
|
|
50
50
|
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"
|
|
@@ -53,21 +53,21 @@ let ee = class extends F {
|
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
re.styles = O`
|
|
57
57
|
svg {
|
|
58
58
|
display: block;
|
|
59
|
-
fill: #e15042;
|
|
59
|
+
fill: var(--color-fail-icon, #e15042);
|
|
60
60
|
}
|
|
61
61
|
`;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
],
|
|
65
|
-
var
|
|
66
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
62
|
+
re = nt([
|
|
63
|
+
T("maptiler-geocode-fail-icon")
|
|
64
|
+
], re);
|
|
65
|
+
var ct = Object.getOwnPropertyDescriptor, ht = (t, e, i, a) => {
|
|
66
|
+
for (var s = a > 1 ? void 0 : a ? ct(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
67
67
|
(r = t[o]) && (s = r(s) || s);
|
|
68
68
|
return s;
|
|
69
69
|
};
|
|
70
|
-
let
|
|
70
|
+
let oe = class extends F {
|
|
71
71
|
render() {
|
|
72
72
|
return m`
|
|
73
73
|
<div>
|
|
@@ -79,7 +79,7 @@ let te = class extends F {
|
|
|
79
79
|
`;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
oe.styles = O`
|
|
83
83
|
div {
|
|
84
84
|
position: absolute;
|
|
85
85
|
left: 50%;
|
|
@@ -106,17 +106,17 @@ te.styles = I`
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
`;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
],
|
|
112
|
-
var
|
|
113
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
109
|
+
oe = ht([
|
|
110
|
+
T("maptiler-geocode-loading-icon")
|
|
111
|
+
], oe);
|
|
112
|
+
var pt = Object.getOwnPropertyDescriptor, dt = (t, e, i, a) => {
|
|
113
|
+
for (var s = a > 1 ? void 0 : a ? pt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
114
114
|
(r = t[o]) && (s = r(s) || s);
|
|
115
115
|
return s;
|
|
116
116
|
};
|
|
117
|
-
let
|
|
117
|
+
let ae = class extends F {
|
|
118
118
|
render() {
|
|
119
|
-
return
|
|
119
|
+
return D`
|
|
120
120
|
<svg viewBox="0 0 60.006 21.412" width="14" height="20">
|
|
121
121
|
<path
|
|
122
122
|
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"
|
|
@@ -125,23 +125,23 @@ let ie = class extends F {
|
|
|
125
125
|
`;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
ae.styles = O`
|
|
129
129
|
svg {
|
|
130
130
|
display: block;
|
|
131
|
-
fill: var(--color-icon-button);
|
|
131
|
+
fill: var(--color-icon-button, #444952);
|
|
132
132
|
}
|
|
133
133
|
`;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
],
|
|
137
|
-
var
|
|
138
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
134
|
+
ae = dt([
|
|
135
|
+
T("maptiler-geocode-reverse-geocoding-icon")
|
|
136
|
+
], ae);
|
|
137
|
+
var ut = Object.getOwnPropertyDescriptor, ft = (t, e, i, a) => {
|
|
138
|
+
for (var s = a > 1 ? void 0 : a ? ut(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
139
139
|
(r = t[o]) && (s = r(s) || s);
|
|
140
140
|
return s;
|
|
141
141
|
};
|
|
142
|
-
let
|
|
142
|
+
let le = class extends F {
|
|
143
143
|
render() {
|
|
144
|
-
return
|
|
144
|
+
return D`
|
|
145
145
|
<svg
|
|
146
146
|
xmlns="http://www.w3.org/2000/svg"
|
|
147
147
|
width="13"
|
|
@@ -154,7 +154,7 @@ let se = class extends F {
|
|
|
154
154
|
`;
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
le.styles = O`
|
|
158
158
|
circle {
|
|
159
159
|
stroke-width: 1.875;
|
|
160
160
|
fill: none;
|
|
@@ -167,30 +167,30 @@ se.styles = I`
|
|
|
167
167
|
|
|
168
168
|
svg {
|
|
169
169
|
display: block;
|
|
170
|
-
stroke: var(--color-icon-button);
|
|
170
|
+
stroke: var(--color-icon-button, #444952);
|
|
171
171
|
}
|
|
172
172
|
`;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
],
|
|
176
|
-
function
|
|
173
|
+
le = ft([
|
|
174
|
+
T("maptiler-geocode-search-icon")
|
|
175
|
+
], le);
|
|
176
|
+
function mt(t, e, i) {
|
|
177
177
|
const a = e[1], s = e[0], o = a - s;
|
|
178
178
|
return t === a && i ? t : ((t - s) % o + o) % o + s;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function K(t) {
|
|
181
181
|
const e = [...t];
|
|
182
182
|
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
183
183
|
}
|
|
184
|
-
let
|
|
185
|
-
async function
|
|
184
|
+
let B;
|
|
185
|
+
async function gt(t, e, i) {
|
|
186
186
|
for (const a of e ?? [])
|
|
187
187
|
if (!(t && (a.minZoom != null && a.minZoom > t[0] || a.maxZoom != null && a.maxZoom < t[0]))) {
|
|
188
188
|
if (a.type === "fixed")
|
|
189
189
|
return a.coordinates.join(",");
|
|
190
190
|
if (a.type === "client-geolocation")
|
|
191
|
-
if (
|
|
192
|
-
if (
|
|
193
|
-
return
|
|
191
|
+
if (B && a.cachedLocationExpiry && B.time + a.cachedLocationExpiry > Date.now()) {
|
|
192
|
+
if (B.coords)
|
|
193
|
+
return B.coords;
|
|
194
194
|
} else {
|
|
195
195
|
let s;
|
|
196
196
|
try {
|
|
@@ -209,7 +209,7 @@ async function ct(t, e, i) {
|
|
|
209
209
|
}), s;
|
|
210
210
|
} catch {
|
|
211
211
|
} finally {
|
|
212
|
-
a.cachedLocationExpiry && (
|
|
212
|
+
a.cachedLocationExpiry && (B = {
|
|
213
213
|
time: Date.now(),
|
|
214
214
|
coords: s
|
|
215
215
|
});
|
|
@@ -223,21 +223,21 @@ async function ct(t, e, i) {
|
|
|
223
223
|
return t[1].toFixed(6) + "," + t[2].toFixed(6);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
var
|
|
226
|
+
const yt = ".sprite-icon{align-self:center;justify-self:center;opacity:var(--icon-items-opacity, .75);background-repeat:no-repeat}li{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-items, #444952);padding:8px 0;font-size:var(--font-size-items, 14px);line-height:1.3;min-width:fit-content;outline:0}li:first-child{padding-top:10px}li:last-child{padding-bottom:10px}li.picked{background-color:var(--color-items-picked-bg, #e7edff)}li.picked .secondary,li.picked .line2{color:var(--color-items-picked-secondary, #96a4c7)}li.selected{background-color:var(--color-items-selected-bg, #f3f6ff);animation:backAndForth 5s linear infinite}li.selected .primary{color:var(--color-items-selected, #2b8bfb)}li.selected .secondary,li.selected .line2{color:var(--color-items-selected-secondary, #a2adc7)}li>img{align-self:center;justify-self:center;opacity:var(--icon-opacity, .75)}.texts{padding:0 17px 0 0}.texts>*{white-space:nowrap;display:block;min-width:fit-content}.primary{font-weight:600}.secondary{color:var(--color-items-secondary, #aeb6c7);padding-left:4px}.line2{color:var(--color-items-secondary, #aeb6c7)}@keyframes backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}";
|
|
227
|
+
var vt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, Te = (t) => {
|
|
228
228
|
throw TypeError(t);
|
|
229
|
-
},
|
|
230
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
229
|
+
}, I = (t, e, i, a) => {
|
|
230
|
+
for (var s = a > 1 ? void 0 : a ? bt(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
231
231
|
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
232
|
-
return a && s &&
|
|
233
|
-
},
|
|
234
|
-
const
|
|
235
|
-
let
|
|
232
|
+
return a && s && vt(e, i, s), s;
|
|
233
|
+
}, Me = (t, e, i) => e.has(t) || Te("Cannot " + i), f = (t, e, i) => (Me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), xt = (t, e, i) => e.has(t) ? Te("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), P = (t, e, i) => (Me(t, e, "access private method"), i), d, j, R, g, Se, Ce, fe, ne;
|
|
234
|
+
const Pe = typeof devicePixelRatio > "u" || devicePixelRatio > 1.25, Ue = Pe ? "@2x" : "", C = Pe ? 2 : 1;
|
|
235
|
+
let S, Be, w = class extends F {
|
|
236
236
|
constructor() {
|
|
237
|
-
super(...arguments),
|
|
237
|
+
super(...arguments), xt(this, d), this.itemStyle = "default", this.showPlaceType = "if-needed", this.missingIconsCache = /* @__PURE__ */ new Set(), this.iconsBaseUrl = "", this.index = 0;
|
|
238
238
|
}
|
|
239
239
|
willUpdate(t) {
|
|
240
|
-
t.has("feature") && f(this, d,
|
|
240
|
+
t.has("feature") && f(this, d, j) && (this.index = f(this, d, j).length, P(this, d, fe).call(this));
|
|
241
241
|
}
|
|
242
242
|
render() {
|
|
243
243
|
return m`
|
|
@@ -249,112 +249,124 @@ let T, Se, k = class extends F {
|
|
|
249
249
|
class=${this.itemStyle}
|
|
250
250
|
@click=${() => this.dispatchEvent(new CustomEvent("select"))}
|
|
251
251
|
>
|
|
252
|
-
${
|
|
252
|
+
${S && this.spriteIcon ? m`
|
|
253
253
|
<div
|
|
254
254
|
class="sprite-icon"
|
|
255
|
-
style=${
|
|
256
|
-
width: `${this.spriteIcon.width /
|
|
257
|
-
height: `${this.spriteIcon.height /
|
|
258
|
-
backgroundImage: `url(${this.iconsBaseUrl}sprite${
|
|
259
|
-
backgroundPosition: `-${this.spriteIcon.x /
|
|
260
|
-
backgroundSize: `${
|
|
255
|
+
style=${Xe({
|
|
256
|
+
width: `${this.spriteIcon.width / C}px`,
|
|
257
|
+
height: `${this.spriteIcon.height / C}px`,
|
|
258
|
+
backgroundImage: `url(${this.iconsBaseUrl}sprite${Ue}.png)`,
|
|
259
|
+
backgroundPosition: `-${this.spriteIcon.x / C}px -${this.spriteIcon.y / C}px`,
|
|
260
|
+
backgroundSize: `${S.width / C}px ${S.height / C}px`
|
|
261
261
|
})}
|
|
262
262
|
title=${f(this, d, g)}
|
|
263
263
|
/>
|
|
264
|
-
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${
|
|
264
|
+
` : this.imageUrl ? m` <img src=${this.imageUrl} alt=${this.category} title=${f(this, d, g)} @error=${P(this, d, Ce)} />` : this.feature?.address ? m` <img src=${this.iconsBaseUrl + "housenumber.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("road.") ? m` <img src=${this.iconsBaseUrl + "road.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("address.") ? m` <img src=${this.iconsBaseUrl + "street.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("postal_code.") ? m` <img src=${this.iconsBaseUrl + "postal_code.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : this.feature?.id.startsWith("poi.") ? m` <img src=${this.iconsBaseUrl + "poi.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : f(this, d, R) ? m` <img src=${this.iconsBaseUrl + "reverse.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> ` : m` <img src=${this.iconsBaseUrl + "area.svg"} alt=${f(this, d, g)} title=${f(this, d, g)} /> `}
|
|
265
265
|
|
|
266
266
|
<span class="texts">
|
|
267
267
|
<span>
|
|
268
|
-
<span class="primary"> ${f(this, d,
|
|
268
|
+
<span class="primary"> ${f(this, d, R) ? this.feature?.place_name : this.feature?.place_name.replace(/,.*/, "")} </span>
|
|
269
269
|
|
|
270
|
-
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, d,
|
|
270
|
+
${this.showPlaceType === "always" || this.showPlaceType !== "never" && !this.feature?.address && !this.feature?.id.startsWith("road.") && !this.feature?.id.startsWith("address.") && !this.feature?.id.startsWith("postal_code.") && (!this.feature?.id.startsWith("poi.") || !this.imageUrl) && !f(this, d, R) ? m` <span class="secondary"> ${f(this, d, g)} </span> ` : ie}
|
|
271
271
|
</span>
|
|
272
272
|
|
|
273
|
-
<span class="line2"> ${f(this, d,
|
|
273
|
+
<span class="line2"> ${f(this, d, R) ? this.feature?.text : this.feature?.place_name.replace(/[^,]*,?s*/, "")} </span>
|
|
274
274
|
</span>
|
|
275
275
|
</li>
|
|
276
276
|
`;
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
279
|
d = /* @__PURE__ */ new WeakSet();
|
|
280
|
-
|
|
280
|
+
j = function() {
|
|
281
281
|
return this.feature?.properties?.categories;
|
|
282
282
|
};
|
|
283
|
-
|
|
283
|
+
R = function() {
|
|
284
284
|
return this.feature?.place_type[0] === "reverse";
|
|
285
285
|
};
|
|
286
286
|
g = function() {
|
|
287
|
-
return this
|
|
287
|
+
return f(this, d, j)?.join(", ") ?? this.feature?.place_type_name?.[0] ?? this.feature?.place_type[0];
|
|
288
288
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
Se = function() {
|
|
290
|
+
Be ??= fetch(`${this.iconsBaseUrl}sprite${Ue}.json`).then((t) => t.json()).then((t) => {
|
|
291
|
+
S = t;
|
|
292
292
|
}).catch(() => {
|
|
293
|
-
|
|
293
|
+
S = null;
|
|
294
294
|
});
|
|
295
295
|
};
|
|
296
|
-
|
|
297
|
-
this.imageUrl && this.missingIconsCache.add(this.imageUrl),
|
|
296
|
+
Ce = function() {
|
|
297
|
+
this.imageUrl && this.missingIconsCache.add(this.imageUrl), P(this, d, fe).call(this);
|
|
298
298
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
fe = function() {
|
|
300
|
+
S !== void 0 ? P(this, d, ne).call(this) : (P(this, d, Se).call(this), Be?.then(() => {
|
|
301
|
+
P(this, d, ne).call(this);
|
|
302
302
|
}));
|
|
303
303
|
};
|
|
304
|
-
|
|
304
|
+
ne = function() {
|
|
305
305
|
do {
|
|
306
|
-
if (this.index--, this.category = f(this, d,
|
|
306
|
+
if (this.index--, this.category = f(this, d, j)?.[this.index], this.spriteIcon = this.category ? S?.icons[this.category] : void 0, this.spriteIcon)
|
|
307
307
|
break;
|
|
308
308
|
this.imageUrl = this.category ? this.iconsBaseUrl + this.category.replace(/ /g, "_") + ".svg" : void 0;
|
|
309
309
|
} while (this.index > -1 && (!this.imageUrl || this.missingIconsCache.has(this.imageUrl)));
|
|
310
310
|
};
|
|
311
|
-
|
|
312
|
-
${
|
|
311
|
+
w.styles = O`
|
|
312
|
+
${ue(yt)}
|
|
313
313
|
`;
|
|
314
|
-
|
|
314
|
+
I([
|
|
315
315
|
p({ type: Object })
|
|
316
|
-
],
|
|
317
|
-
|
|
316
|
+
], w.prototype, "feature", 2);
|
|
317
|
+
I([
|
|
318
318
|
p({ type: String })
|
|
319
|
-
],
|
|
320
|
-
|
|
319
|
+
], w.prototype, "itemStyle", 2);
|
|
320
|
+
I([
|
|
321
321
|
p({ type: String })
|
|
322
|
-
],
|
|
323
|
-
|
|
322
|
+
], w.prototype, "showPlaceType", 2);
|
|
323
|
+
I([
|
|
324
324
|
p({ attribute: !1 })
|
|
325
|
-
],
|
|
326
|
-
|
|
325
|
+
], w.prototype, "missingIconsCache", 2);
|
|
326
|
+
I([
|
|
327
327
|
p({ type: String })
|
|
328
|
-
],
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
],
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
],
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
],
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
],
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
],
|
|
344
|
-
const
|
|
345
|
-
var
|
|
328
|
+
], w.prototype, "iconsBaseUrl", 2);
|
|
329
|
+
I([
|
|
330
|
+
x()
|
|
331
|
+
], w.prototype, "category", 2);
|
|
332
|
+
I([
|
|
333
|
+
x()
|
|
334
|
+
], w.prototype, "imageUrl", 2);
|
|
335
|
+
I([
|
|
336
|
+
x()
|
|
337
|
+
], w.prototype, "spriteIcon", 2);
|
|
338
|
+
I([
|
|
339
|
+
x()
|
|
340
|
+
], w.prototype, "index", 2);
|
|
341
|
+
w = I([
|
|
342
|
+
T("maptiler-geocoder-feature-item")
|
|
343
|
+
], w);
|
|
344
|
+
const wt = 'form{font-family:var(--font-family, "Open Sans", "Ubuntu", "Helvetica Neue", Arial, Helvetica, sans-serif);position:relative;background-color:var(--color-bg, #fff);z-index:10;border-radius:var(--radius, 4px);margin:0;transition:max-width .25s;box-shadow:var(--shadow, 0px 2px 5px rgba(51, 51, 89, .15));pointer-events:all}form,form *,form *:after,form *:before{box-sizing:border-box}form.can-collapse{max-width:var(--size-collapse-width, 29px)}form.can-collapse input::placeholder{transition:opacity .25s;opacity:0}form,form.can-collapse:focus-within,form.can-collapse:hover{width:var(--size-width, 270px);max-width:var(--size-width, 270px)}form input::placeholder,form:focus-within input::placeholder,form:hover input::placeholder{opacity:1}input{font:inherit;font-size:var(--font-size-input, 14px);flex-grow:1;min-height:var(--size-input-min-height, 29px);background-color:transparent;color:var(--color-input, #444952);white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input:focus{color:var(--color-input-focus, #444952);outline:0;box-shadow:none}ul,div.error,div.no-results{background-color:var(--color-bg-dropdown, #fff);border-radius:var(--radius-dropdown, 4px);left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul{font-size:var(--font-size-items, 14px);line-height:16px;box-shadow:var(--shadow-dropdown, 0px 5px 10px rgba(51, 51, 89, .15))}div.error,div.no-results{font:inherit;line-height:18px;font-size:var(--font-size-error, 12px);display:flex;gap:16px}div.error{padding:16px;font-weight:600;color:var(--color-error-text, #e25041);background-color:var(--color-error-bg, #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: var(--color-error-icon, #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:var(--color-no-results-text, #6b7c93);box-shadow:var(--shadow-dropdown, 0px 5px 10px rgba(51, 51, 89, .15))}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: var(--color-icon-button-hover, #2b8bfb)}.input-group{display:flex;align-items:stretch;gap:var(--input-group-gap, 7px);padding:var(--input-group-padding, 0 8px);border-radius:var(--radius-input-group, 4px);overflow:hidden}.input-group:focus-within{outline:var(--color-focus-outline, #2b8bfb) solid var(--size-focus-outline, 2px)}.search-button{flex-shrink:0}.clear-button-container{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:var(--color-input-group-border, white solid 2px)}:host(.maptiler-geocoder) .input-group:focus-within{border:var(--color-input-group-border-focused, #2b8bfb solid 2px);outline:0}:host(.maptiler-geocoder) form.can-collapse{max-width:var(--size-collapse-width, 33px)}:host(.maptiler-geocoder) form,:host(.leaflet-geocoder) form,:host(.maptiler-geocoder) form.can-collapse:focus-within,:host(.leaflet-geocoder) form.can-collapse:focus-within,:host(.maptiler-geocoder) form.can-collapse:hover,:host(.leaflet-geocoder) form.can-collapse:hover{width:var(--size-width, 270px);max-width:var(--size-width, 270px)}:host(.leaflet-geocoder) .input-group{border:var(--color-input-group-border, white solid 1px)}:host(.leaflet-geocoder) form.can-collapse{max-width:var(--size-collapse-width, 30px)}';
|
|
345
|
+
var kt = Object.defineProperty, _t = Object.getOwnPropertyDescriptor, ze = (t) => {
|
|
346
346
|
throw TypeError(t);
|
|
347
|
-
},
|
|
348
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
347
|
+
}, h = (t, e, i, a) => {
|
|
348
|
+
for (var s = a > 1 ? void 0 : a ? _t(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
349
349
|
(r = t[o]) && (s = (a ? r(e, i, s) : r(s)) || s);
|
|
350
|
-
return a && s &&
|
|
351
|
-
},
|
|
350
|
+
return a && s && kt(e, i, s), s;
|
|
351
|
+
}, me = (t, e, i) => e.has(t) || ze("Cannot " + i), k = (t, e, i) => (me(t, e, "read from private field"), i ? i.call(t) : e.get(t)), z = (t, e, i) => e.has(t) ? ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), ce = (t, e, i, a) => (me(t, e, "write to private field"), e.set(t, i), i), c = (t, e, i) => (me(t, e, "access private method"), i), Q, A, he, W, l, H, ge, b, ye, Y, ve, be, $, xe, J, Re, Ge, pe, je, Ae, We, De, Ve, qe, Ne, Ze, Ke, Qe, E, G;
|
|
352
|
+
const we = "input:not([type]), input[type=text], input[type=search], select, textarea", X = "button, input[type=button]";
|
|
352
353
|
let n = class extends F {
|
|
353
354
|
constructor() {
|
|
354
|
-
super(...arguments),
|
|
355
|
+
super(...arguments), z(this, l), this.clearListOnPick = !1, this.clearOnBlur = !1, this.collapsed = !1, this.excludeTypes = !1, this.exhaustiveReverseGeocoding = !1, this.fetchFullGeometryOnPick = !1, this.keepListOpen = !1, this.openListOnTop = !1, this.reverseActive = !1, this.searchValue = "", this.selectedItemIndex = -1, this.cachedFeatures = [], this.lastSearchUrl = "", this.focused = !1, this.isFeatureListVisible = !1, this.isFeatureListInteractedWith = !1, z(this, Q, !1), z(this, A), z(this, he, /* @__PURE__ */ new Set()), z(this, W);
|
|
356
|
+
}
|
|
357
|
+
get isLoading() {
|
|
358
|
+
return this.abortController !== void 0;
|
|
359
|
+
}
|
|
360
|
+
get input() {
|
|
361
|
+
for (const t of this.contentSlotElements) {
|
|
362
|
+
if (c(this, l, E).call(this, t)) return t;
|
|
363
|
+
const e = t.querySelector(we);
|
|
364
|
+
if (c(this, l, E).call(this, e)) return e;
|
|
365
|
+
}
|
|
366
|
+
return this.inputSlotElements[0];
|
|
355
367
|
}
|
|
356
368
|
firstUpdated() {
|
|
357
|
-
|
|
369
|
+
ce(this, Q, !0), this.input && (this.input.value = this.searchValue);
|
|
358
370
|
}
|
|
359
371
|
/**
|
|
360
372
|
* Set the options of this instance.
|
|
@@ -364,7 +376,7 @@ let n = class extends F {
|
|
|
364
376
|
setOptions(t) {
|
|
365
377
|
const e = { ...t };
|
|
366
378
|
for (const i of Object.keys(e))
|
|
367
|
-
|
|
379
|
+
Lt.includes(i) || delete e[i];
|
|
368
380
|
Object.assign(this, e);
|
|
369
381
|
}
|
|
370
382
|
/**
|
|
@@ -373,7 +385,7 @@ let n = class extends F {
|
|
|
373
385
|
* @param value text to set
|
|
374
386
|
*/
|
|
375
387
|
setQuery(t) {
|
|
376
|
-
|
|
388
|
+
c(this, l, be).call(this, t, { external: !0 }), c(this, l, ve).call(this);
|
|
377
389
|
}
|
|
378
390
|
/**
|
|
379
391
|
* Set the content of search input box and immediately submit it.
|
|
@@ -381,13 +393,13 @@ let n = class extends F {
|
|
|
381
393
|
* @param value text to set and submit
|
|
382
394
|
*/
|
|
383
395
|
submitQuery(t) {
|
|
384
|
-
|
|
396
|
+
c(this, l, xe).call(this, t, { external: !0 });
|
|
385
397
|
}
|
|
386
398
|
/**
|
|
387
399
|
* Clear search result list.
|
|
388
400
|
*/
|
|
389
401
|
clearList() {
|
|
390
|
-
|
|
402
|
+
c(this, l, $).call(this), this.picked = void 0, this.selectedItemIndex = -1;
|
|
391
403
|
}
|
|
392
404
|
/**
|
|
393
405
|
* Focus the search input box.
|
|
@@ -395,13 +407,13 @@ let n = class extends F {
|
|
|
395
407
|
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
396
408
|
*/
|
|
397
409
|
focus(t) {
|
|
398
|
-
this.input
|
|
410
|
+
this.input?.focus(t);
|
|
399
411
|
}
|
|
400
412
|
/**
|
|
401
413
|
* Blur the search input box.
|
|
402
414
|
*/
|
|
403
415
|
blur() {
|
|
404
|
-
this.input
|
|
416
|
+
this.input?.blur();
|
|
405
417
|
}
|
|
406
418
|
addEventListener(t, e, i) {
|
|
407
419
|
super.addEventListener(t, e, i);
|
|
@@ -411,83 +423,101 @@ let n = class extends F {
|
|
|
411
423
|
}
|
|
412
424
|
/** @internal */
|
|
413
425
|
handleMapChange(t) {
|
|
414
|
-
|
|
426
|
+
ce(this, W, t);
|
|
415
427
|
}
|
|
416
428
|
/** @internal */
|
|
417
429
|
handleMapClick(t) {
|
|
418
|
-
this.reverseActive &&
|
|
430
|
+
this.reverseActive && c(this, l, Re).call(this, t);
|
|
419
431
|
}
|
|
420
432
|
willUpdate(t) {
|
|
421
|
-
t.has("error") && this.error && console.error("[MapTilerGeocodingControl] Error:", this.error), t.has("enableReverse") && (this.reverseActive = this.enableReverse === "always"), ["picked"].some((e) => t.has(e)) && this.picked && (this.clearListOnPick &&
|
|
433
|
+
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 && c(this, l, $).call(this), this.selectedItemIndex = -1), ["searchValue", "minLength"].some((e) => t.has(e)) && k(this, l, ge) && (c(this, l, $).call(this), this.error = void 0), ["focused", "listIsInteractedWith"].some((e) => t.has(e)) && this.clearOnBlur && !this.focused && !this.isFeatureListInteractedWith && (this.searchValue = ""), ["selectFirst", "listFeatures", "selectedItemIndex", "picked"].some((e) => t.has(e)) && this.selectFirst !== !1 && this.listFeatures?.length && this.selectedItemIndex == -1 && !this.picked && (this.selectedItemIndex = 0), ["listFeatures", "selectedItemIndex"].some((e) => t.has(e)) && c(this, l, b).call(this, "select", { feature: k(this, l, H) }), ["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" ? c(this, l, J).call(this, this.picked.id, { byId: !0 }) : Promise.resolve()).then(
|
|
422
434
|
() => {
|
|
423
|
-
|
|
435
|
+
c(this, l, b).call(this, "pick", { feature: this.picked });
|
|
424
436
|
},
|
|
425
437
|
(e) => {
|
|
426
|
-
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e,
|
|
438
|
+
e && typeof e == "object" && "name" in e && e.name === "AbortError" || (this.error = e, c(this, l, b).call(this, "pick", { feature: this.picked }));
|
|
427
439
|
}
|
|
428
|
-
), ["listFeatures", "focused", "isFeatureListInteractedWith", "keepListOpen"].some((e) => t.has(e)) && (this.isFeatureListVisible = !!this.listFeatures?.length && (this.focused || this.isFeatureListInteractedWith || this.keepListOpen)), ["isFeatureListVisible"].some((e) => t.has(e)) && (this.isFeatureListVisible ?
|
|
440
|
+
), ["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 ? c(this, l, b).call(this, "featuresshow") : c(this, l, b).call(this, "featureshide")), ["reverseActive"].some((e) => t.has(e)) && c(this, l, b).call(this, "reversetoggle", { reverse: this.reverseActive }), ["searchValue"].some((e) => t.has(e)) && this.input && (this.input.value = this.searchValue);
|
|
429
441
|
}
|
|
430
442
|
render() {
|
|
431
443
|
return m`
|
|
432
|
-
<form
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
444
|
+
<form
|
|
445
|
+
class=${q({ "can-collapse": this.collapsed && this.searchValue === "" })}
|
|
446
|
+
@submit=${c(this, l, ye)}
|
|
447
|
+
@focusin=${c(this, l, We)}
|
|
448
|
+
@focusout=${c(this, l, De)}
|
|
449
|
+
@click=${c(this, l, Ge)}
|
|
450
|
+
@keydown=${c(this, l, pe)}
|
|
451
|
+
@input=${c(this, l, je)}
|
|
452
|
+
@change=${c(this, l, Ae)}
|
|
453
|
+
>
|
|
454
|
+
<slot name="content">
|
|
455
|
+
<div class="input-group">
|
|
456
|
+
<slot name="start"></slot>
|
|
443
457
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
@change=${() => this.picked = void 0}
|
|
452
|
-
placeholder=${this.placeholder ?? "Search"}
|
|
453
|
-
aria-label=${this.placeholder ?? "Search"}
|
|
454
|
-
/>
|
|
458
|
+
<slot name="search-button">
|
|
459
|
+
<button class="search-button" type="button">
|
|
460
|
+
<slot name="search-icon">
|
|
461
|
+
<maptiler-geocode-search-icon></maptiler-geocode-search-icon>
|
|
462
|
+
</slot>
|
|
463
|
+
</button>
|
|
464
|
+
</slot>
|
|
455
465
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
460
|
-
</button>
|
|
461
|
-
`}
|
|
462
|
-
</div>
|
|
466
|
+
<slot name="input">
|
|
467
|
+
<input placeholder=${this.placeholder ?? "Search"} aria-label=${this.placeholder ?? "Search"} />
|
|
468
|
+
</slot>
|
|
463
469
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
<div class="clear-button-container ${q({ displayable: this.searchValue !== "" })}">
|
|
471
|
+
${this.isLoading ? m`
|
|
472
|
+
<slot name="loading-icon">
|
|
473
|
+
<maptiler-geocode-loading-icon></maptiler-geocode-loading-icon>
|
|
474
|
+
</slot>
|
|
475
|
+
` : m`
|
|
476
|
+
<slot name="clear-button">
|
|
477
|
+
<button type="button" title=${this.clearButtonTitle ?? "clear"}>
|
|
478
|
+
<slot name="clear-icon">
|
|
479
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
480
|
+
</slot>
|
|
481
|
+
</button>
|
|
482
|
+
</slot>
|
|
483
|
+
`}
|
|
484
|
+
</div>
|
|
474
485
|
|
|
475
|
-
|
|
476
|
-
|
|
486
|
+
${this.enableReverse === "button" ? m`
|
|
487
|
+
<slot name="reverse-button">
|
|
488
|
+
<button type="button" class=${q({ active: this.reverseActive })} title=${this.reverseButtonTitle ?? "toggle reverse geocoding"}>
|
|
489
|
+
<slot name="reverse-icon">
|
|
490
|
+
<maptiler-geocode-reverse-geocoding-icon></maptiler-geocode-reverse-geocoding-icon>
|
|
491
|
+
</slot>
|
|
492
|
+
</button>
|
|
493
|
+
</slot>
|
|
494
|
+
` : ie}
|
|
495
|
+
|
|
496
|
+
<slot name="end"></slot>
|
|
497
|
+
</div>
|
|
498
|
+
</slot>
|
|
477
499
|
|
|
478
500
|
${this.error ? m`
|
|
479
501
|
<div class="error">
|
|
480
|
-
<
|
|
502
|
+
<slot name="error-icon">
|
|
503
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
504
|
+
</slot>
|
|
481
505
|
|
|
482
506
|
<div>${this.errorMessage ?? "Something went wrong…"}</div>
|
|
483
507
|
|
|
484
|
-
<
|
|
485
|
-
<
|
|
486
|
-
|
|
508
|
+
<slot name="clear-error-button">
|
|
509
|
+
<button>
|
|
510
|
+
<slot name="clear-error-icon">
|
|
511
|
+
<maptiler-geocode-clear-icon></maptiler-geocode-clear-icon>
|
|
512
|
+
</slot>
|
|
513
|
+
</button>
|
|
514
|
+
</slot>
|
|
487
515
|
</div>
|
|
488
|
-
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ?
|
|
516
|
+
` : !this.focused && !this.isFeatureListInteractedWith && !this.keepListOpen || this.listFeatures === void 0 ? ie : this.listFeatures.length === 0 ? m`
|
|
489
517
|
<div class="no-results">
|
|
490
|
-
<
|
|
518
|
+
<slot name="no-results-icon">
|
|
519
|
+
<maptiler-geocode-fail-icon></maptiler-geocode-fail-icon>
|
|
520
|
+
</slot>
|
|
491
521
|
|
|
492
522
|
<div>
|
|
493
523
|
${this.noResultsMessage ?? "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}
|
|
@@ -495,14 +525,14 @@ let n = class extends F {
|
|
|
495
525
|
</div>
|
|
496
526
|
` : m`
|
|
497
527
|
<ul
|
|
498
|
-
class="options ${
|
|
499
|
-
@pointerleave=${
|
|
500
|
-
@pointerdown=${
|
|
501
|
-
@pointerup=${
|
|
502
|
-
@keydown=${
|
|
528
|
+
class="options ${q({ "open-on-top": this.openListOnTop })}"
|
|
529
|
+
@pointerleave=${c(this, l, Ne)}
|
|
530
|
+
@pointerdown=${c(this, l, Ze)}
|
|
531
|
+
@pointerup=${c(this, l, Ke)}
|
|
532
|
+
@keydown=${c(this, l, pe)}
|
|
503
533
|
role="listbox"
|
|
504
534
|
>
|
|
505
|
-
${
|
|
535
|
+
${Je(
|
|
506
536
|
this.listFeatures,
|
|
507
537
|
(t) => t.id + (t.address ? "," + t.address : ""),
|
|
508
538
|
(t, e) => m`
|
|
@@ -511,13 +541,13 @@ let n = class extends F {
|
|
|
511
541
|
.showPlaceType=${this.showPlaceType ?? "if-needed"}
|
|
512
542
|
itemStyle=${this.selectedItemIndex === e ? "selected" : this.picked?.id === t.id ? "picked" : "default"}
|
|
513
543
|
@pointerenter=${() => {
|
|
514
|
-
|
|
544
|
+
c(this, l, qe).call(this, e);
|
|
515
545
|
}}
|
|
516
546
|
@select=${() => {
|
|
517
|
-
|
|
547
|
+
c(this, l, Ve).call(this, t);
|
|
518
548
|
}}
|
|
519
|
-
.missingIconsCache=${
|
|
520
|
-
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.
|
|
549
|
+
.missingIconsCache=${k(this, he)}
|
|
550
|
+
.iconsBaseUrl=${this.iconsBaseUrl ?? "https://cdn.maptiler.com/maptiler-geocoding-control/v3.1.0-rc.1/icons/"}
|
|
521
551
|
/>
|
|
522
552
|
`
|
|
523
553
|
)}
|
|
@@ -527,22 +557,19 @@ let n = class extends F {
|
|
|
527
557
|
`;
|
|
528
558
|
}
|
|
529
559
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
560
|
+
Q = /* @__PURE__ */ new WeakMap();
|
|
561
|
+
A = /* @__PURE__ */ new WeakMap();
|
|
562
|
+
he = /* @__PURE__ */ new WeakMap();
|
|
563
|
+
W = /* @__PURE__ */ new WeakMap();
|
|
534
564
|
l = /* @__PURE__ */ new WeakSet();
|
|
535
|
-
|
|
565
|
+
H = function() {
|
|
536
566
|
return this.listFeatures?.[this.selectedItemIndex];
|
|
537
567
|
};
|
|
538
|
-
|
|
539
|
-
return this.abortController !== void 0;
|
|
540
|
-
};
|
|
541
|
-
de = function() {
|
|
568
|
+
ge = function() {
|
|
542
569
|
return this.searchValue.length < (this.minLength ?? 2);
|
|
543
570
|
};
|
|
544
|
-
|
|
545
|
-
|
|
571
|
+
b = function(t, ...[e]) {
|
|
572
|
+
k(this, Q) && this.dispatchEvent(
|
|
546
573
|
new CustomEvent(t, {
|
|
547
574
|
bubbles: !0,
|
|
548
575
|
composed: !0,
|
|
@@ -550,78 +577,78 @@ x = function(t, ...[e]) {
|
|
|
550
577
|
})
|
|
551
578
|
);
|
|
552
579
|
};
|
|
553
|
-
|
|
554
|
-
t?.preventDefault(), this.focused = !1, clearTimeout(
|
|
580
|
+
ye = function(t, { external: e = !1 } = {}) {
|
|
581
|
+
t?.preventDefault(), this.focused = !1, clearTimeout(k(this, A)), 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 && c(this, l, J).call(this, this.searchValue, { exact: !0, external: e }).then(() => {
|
|
555
582
|
this.picked = void 0;
|
|
556
583
|
}).catch((i) => this.error = i);
|
|
557
584
|
};
|
|
558
|
-
|
|
585
|
+
Y = function(t) {
|
|
559
586
|
try {
|
|
560
|
-
return
|
|
587
|
+
return Ye(t, 6);
|
|
561
588
|
} catch {
|
|
562
589
|
return !1;
|
|
563
590
|
}
|
|
564
591
|
};
|
|
565
|
-
|
|
592
|
+
ve = function() {
|
|
566
593
|
setTimeout(() => {
|
|
567
|
-
this.input
|
|
594
|
+
this.input?.focus(), this.focused = !0, this.input instanceof HTMLSelectElement ? this.input.showPicker() : this.input?.select();
|
|
568
595
|
});
|
|
569
596
|
};
|
|
570
|
-
|
|
571
|
-
if (this.searchValue = t,
|
|
572
|
-
if (clearTimeout(
|
|
597
|
+
be = function(t, { external: e = !1 } = {}) {
|
|
598
|
+
if (this.searchValue = t, c(this, l, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, l, Y).call(this, t) }), this.error = void 0, this.picked = void 0, this.showResultsWhileTyping !== !1) {
|
|
599
|
+
if (clearTimeout(k(this, A)), k(this, l, ge))
|
|
573
600
|
return;
|
|
574
601
|
const i = this.searchValue;
|
|
575
|
-
|
|
576
|
-
|
|
602
|
+
ce(this, A, window.setTimeout(() => {
|
|
603
|
+
c(this, l, J).call(this, i, { external: e }).catch((a) => this.error = a);
|
|
577
604
|
}, this.debounceSearch ?? 200));
|
|
578
605
|
} else
|
|
579
|
-
|
|
606
|
+
c(this, l, $).call(this);
|
|
580
607
|
};
|
|
581
608
|
$ = function() {
|
|
582
|
-
this.listFeatures !== void 0 && (this.listFeatures = void 0,
|
|
609
|
+
this.listFeatures !== void 0 && (this.listFeatures = void 0, c(this, l, b).call(this, "featuresclear"));
|
|
583
610
|
};
|
|
584
|
-
|
|
585
|
-
this.searchValue = t,
|
|
611
|
+
xe = function(t, { external: e = !1 } = {}) {
|
|
612
|
+
this.searchValue = t, c(this, l, b).call(this, "querychange", { query: this.searchValue, reverseCoords: c(this, l, Y).call(this, t) }), this.selectedItemIndex = -1, c(this, l, ye).call(this, void 0, { external: e });
|
|
586
613
|
};
|
|
587
|
-
|
|
614
|
+
J = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
588
615
|
this.error = void 0, this.abortController?.abort();
|
|
589
616
|
const s = new AbortController();
|
|
590
617
|
this.abortController = s;
|
|
591
618
|
try {
|
|
592
|
-
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r =
|
|
619
|
+
const o = this.apiUrl ?? "https://api.maptiler.com/geocoding", r = c(this, l, Y).call(this, t), u = new URL(o + "/" + encodeURIComponent(r ? `${r.decimalLongitude},${r.decimalLatitude}` : t) + ".json"), y = u.searchParams;
|
|
593
620
|
this.language !== void 0 && y.set("language", Array.isArray(this.language) ? this.language.join(",") : this.language ?? "");
|
|
594
|
-
const [M] =
|
|
595
|
-
let
|
|
621
|
+
const [M] = k(this, W) ?? [void 0];
|
|
622
|
+
let _ = (!r || this.reverseGeocodingTypes === void 0 ? this.types : this.reverseGeocodingTypes)?.map(
|
|
596
623
|
(v) => typeof v == "string" ? v : M === void 0 || (v[0] ?? 0) <= M && M < (v[1] ?? 1 / 0) ? v[2] : void 0
|
|
597
624
|
).filter((v) => v !== void 0);
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
601
|
-
const v = this.proximity ?? [{ type: "server-geolocation" }],
|
|
602
|
-
|
|
625
|
+
_ && (_ = [...new Set(_)], y.set("types", _.join(",")));
|
|
626
|
+
const ke = !r || this.reverseGeocodingExcludeTypes === void 0 ? this.excludeTypes : this.reverseGeocodingExcludeTypes;
|
|
627
|
+
if (ke && y.set("excludeTypes", String(ke)), this.bbox && y.set("bbox", this.bbox.map((v) => v.toFixed(6)).join(",")), this.country && y.set("country", Array.isArray(this.country) ? this.country.join(",") : this.country), this.worldview && y.set("worldview", this.worldview), !e && !r) {
|
|
628
|
+
const v = this.proximity ?? [{ type: "server-geolocation" }], Le = await gt(k(this, W), v, s);
|
|
629
|
+
Le && y.set("proximity", Le), (i || this.showResultsWhileTyping === !1) && y.set("autocomplete", "false"), y.set("fuzzyMatch", String(this.fuzzyMatch !== !1));
|
|
603
630
|
}
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
e ? (this.clearListOnPick &&
|
|
631
|
+
const _e = this.limit ?? 5, ee = this.reverseGeocodingLimit ?? _e;
|
|
632
|
+
ee > 1 && _?.length !== 1 && console.warn("[MapTilerGeocodingControl] Warning: For reverse geocoding when limit > 1 then types must contain single value."), r ? (ee === 1 || this.exhaustiveReverseGeocoding || _?.length === 1) && y.set("limit", String(ee)) : y.set("limit", String(_e)), this.apiKey && y.set("key", this.apiKey), this.adjustUrl?.(u);
|
|
633
|
+
const He = u.searchParams.get("types") === "" && u.searchParams.get("excludeTypes") !== "true", V = u.toString();
|
|
634
|
+
if (V === this.lastSearchUrl) {
|
|
635
|
+
e ? (this.clearListOnPick && c(this, l, $).call(this), this.picked = this.cachedFeatures[0]) : (this.listFeatures = this.cachedFeatures, c(this, l, b).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, H)?.id && (this.selectedItemIndex = -1));
|
|
609
636
|
return;
|
|
610
637
|
}
|
|
611
|
-
|
|
612
|
-
let
|
|
613
|
-
if (
|
|
614
|
-
|
|
638
|
+
c(this, l, b).call(this, "request", { urlObj: u }), this.lastSearchUrl = V;
|
|
639
|
+
let U;
|
|
640
|
+
if (He)
|
|
641
|
+
U = { type: "FeatureCollection", features: [] };
|
|
615
642
|
else {
|
|
616
|
-
const v = await fetch(
|
|
643
|
+
const v = await fetch(V, {
|
|
617
644
|
signal: s.signal,
|
|
618
645
|
...this.fetchParameters
|
|
619
646
|
});
|
|
620
647
|
if (!v.ok)
|
|
621
648
|
throw new Error(await v.text());
|
|
622
|
-
|
|
649
|
+
U = await v.json();
|
|
623
650
|
}
|
|
624
|
-
|
|
651
|
+
c(this, l, b).call(this, "response", { url: V, featureCollection: U }), e ? (this.clearListOnPick && c(this, l, $).call(this), this.picked = U.features[0], this.cachedFeatures = [this.picked]) : (this.listFeatures = U.features.filter(this.filter ?? (() => !0)), r && this.listFeatures.unshift({
|
|
625
652
|
type: "Feature",
|
|
626
653
|
properties: {},
|
|
627
654
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
@@ -637,7 +664,7 @@ Q = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
|
637
664
|
type: "Point",
|
|
638
665
|
coordinates: [r.decimalLongitude, r.decimalLatitude]
|
|
639
666
|
}
|
|
640
|
-
}),
|
|
667
|
+
}), c(this, l, b).call(this, "featureslisted", { features: this.listFeatures, external: a }), this.cachedFeatures = this.listFeatures, this.listFeatures[this.selectedItemIndex]?.id !== k(this, l, H)?.id && (this.selectedItemIndex = -1), r && this.input?.focus());
|
|
641
668
|
} catch (o) {
|
|
642
669
|
if (o && typeof o == "object" && "name" in o && o.name === "AbortError")
|
|
643
670
|
return;
|
|
@@ -646,192 +673,237 @@ Q = async function(t, { byId: e = !1, exact: i = !1, external: a = !1 } = {}) {
|
|
|
646
673
|
s === this.abortController && (this.abortController = void 0);
|
|
647
674
|
}
|
|
648
675
|
};
|
|
649
|
-
|
|
650
|
-
this.reverseActive = this.enableReverse === "always",
|
|
676
|
+
Re = function(t) {
|
|
677
|
+
this.reverseActive = this.enableReverse === "always", c(this, l, $).call(this), this.picked = void 0, c(this, l, xe).call(this, `${t[1].toFixed(6)}, ${mt(t[0], [-180, 180], !0).toFixed(6)}`), c(this, l, ve).call(this);
|
|
678
|
+
};
|
|
679
|
+
Ge = function(t) {
|
|
680
|
+
c(this, l, E).call(this, t.target) ? this.focused = !0 : c(this, l, G).call(this, t.target, this.searchButtonElements, this.searchIconElements, "search-button") ? this.input?.focus() : c(this, l, G).call(this, t.target, this.clearButtonElements, this.clearIconElements, "clear-button") ? c(this, l, Qe).call(this) : c(this, l, G).call(this, t.target, this.reverseButtonElements, this.reverseIconElements, "reverse-button") ? this.reverseActive = !this.reverseActive : c(this, l, G).call(this, t.target, this.clearErrorButtonElements, this.clearErrorIconElements, "clear-error-button") && (this.error = void 0);
|
|
651
681
|
};
|
|
652
|
-
|
|
682
|
+
pe = function(t) {
|
|
653
683
|
if (!this.listFeatures)
|
|
654
684
|
return;
|
|
655
685
|
const e = t.key === "ArrowDown" ? 1 : t.key === "ArrowUp" ? -1 : 0;
|
|
656
|
-
e && (this.input
|
|
686
|
+
e && (this.input?.focus(), this.focused = !0, t.preventDefault(), this.picked && this.selectedItemIndex === -1 && (this.selectedItemIndex = this.listFeatures.findIndex((i) => i.id === this.picked?.id)), this.selectedItemIndex === (this.picked || this.selectFirst !== !1 ? 0 : -1) && e === -1 && (this.selectedItemIndex = this.listFeatures.length), this.selectedItemIndex += e, this.selectedItemIndex >= this.listFeatures.length && (this.selectedItemIndex = -1), this.selectedItemIndex < 0 && (this.picked || this.selectFirst !== !1) && (this.selectedItemIndex = 0));
|
|
657
687
|
};
|
|
658
|
-
|
|
659
|
-
|
|
688
|
+
je = function(t) {
|
|
689
|
+
c(this, l, E).call(this, t.target) && c(this, l, be).call(this, t.target.value);
|
|
660
690
|
};
|
|
661
|
-
|
|
691
|
+
Ae = function(t) {
|
|
692
|
+
c(this, l, E).call(this, t.target) && (this.picked = void 0);
|
|
693
|
+
};
|
|
694
|
+
We = function(t) {
|
|
695
|
+
c(this, l, E).call(this, t.target) && (this.focused = !0);
|
|
696
|
+
};
|
|
697
|
+
De = function(t) {
|
|
698
|
+
c(this, l, E).call(this, t.target) && (this.focused = !1);
|
|
699
|
+
};
|
|
700
|
+
Ve = function(t) {
|
|
662
701
|
(!this.picked || this.picked.id !== t.id) && (this.picked = t, this.searchValue = t.place_name);
|
|
663
702
|
};
|
|
664
|
-
|
|
703
|
+
qe = function(t) {
|
|
665
704
|
this.selectedItemIndex = t;
|
|
666
705
|
};
|
|
667
|
-
|
|
706
|
+
Ne = function() {
|
|
668
707
|
(!this.selectFirst || this.picked) && (this.selectedItemIndex = -1), this.isFeatureListInteractedWith && (this.isFeatureListInteractedWith = !1);
|
|
669
708
|
};
|
|
670
|
-
|
|
709
|
+
Ze = function() {
|
|
671
710
|
this.isFeatureListInteractedWith = !0;
|
|
672
711
|
};
|
|
673
|
-
|
|
712
|
+
Ke = function() {
|
|
674
713
|
setTimeout(() => {
|
|
675
714
|
this.isFeatureListInteractedWith = !1;
|
|
676
715
|
});
|
|
677
716
|
};
|
|
678
|
-
|
|
679
|
-
this.searchValue = "",
|
|
717
|
+
Qe = function() {
|
|
718
|
+
this.searchValue = "", c(this, l, b).call(this, "queryclear"), this.picked = void 0, this.input?.focus();
|
|
719
|
+
};
|
|
720
|
+
E = function(t) {
|
|
721
|
+
return t instanceof HTMLElement && t.matches(we);
|
|
722
|
+
};
|
|
723
|
+
G = function(t, e, i, a) {
|
|
724
|
+
return t instanceof HTMLElement && ([...e, ...i].some((s) => s.contains(t)) || t.closest(`[data-${a}]`) !== null);
|
|
680
725
|
};
|
|
681
|
-
n.styles =
|
|
682
|
-
${
|
|
726
|
+
n.styles = O`
|
|
727
|
+
${ue(wt)}
|
|
683
728
|
`;
|
|
684
|
-
|
|
729
|
+
h([
|
|
685
730
|
p({ attribute: !1 })
|
|
686
731
|
], n.prototype, "adjustUrl", 2);
|
|
687
|
-
|
|
732
|
+
h([
|
|
688
733
|
p({ type: String })
|
|
689
734
|
], n.prototype, "apiKey", 2);
|
|
690
|
-
|
|
735
|
+
h([
|
|
691
736
|
p({ type: String })
|
|
692
737
|
], n.prototype, "apiUrl", 2);
|
|
693
|
-
|
|
738
|
+
h([
|
|
694
739
|
p({ type: Array })
|
|
695
740
|
], n.prototype, "bbox", 2);
|
|
696
|
-
|
|
741
|
+
h([
|
|
697
742
|
p({ type: String })
|
|
698
743
|
], n.prototype, "clearButtonTitle", 2);
|
|
699
|
-
|
|
744
|
+
h([
|
|
700
745
|
p({ type: Boolean })
|
|
701
746
|
], n.prototype, "clearListOnPick", 2);
|
|
702
|
-
|
|
747
|
+
h([
|
|
703
748
|
p({ type: Boolean })
|
|
704
749
|
], n.prototype, "clearOnBlur", 2);
|
|
705
|
-
|
|
750
|
+
h([
|
|
706
751
|
p({ type: Boolean })
|
|
707
752
|
], n.prototype, "collapsed", 2);
|
|
708
|
-
|
|
753
|
+
h([
|
|
709
754
|
p({ attribute: !1 })
|
|
710
755
|
], n.prototype, "country", 2);
|
|
711
|
-
|
|
756
|
+
h([
|
|
712
757
|
p({ type: Number })
|
|
713
758
|
], n.prototype, "debounceSearch", 2);
|
|
714
|
-
|
|
759
|
+
h([
|
|
715
760
|
p({ type: String })
|
|
716
761
|
], n.prototype, "enableReverse", 2);
|
|
717
|
-
|
|
762
|
+
h([
|
|
718
763
|
p({ type: String })
|
|
719
764
|
], n.prototype, "errorMessage", 2);
|
|
720
|
-
|
|
765
|
+
h([
|
|
721
766
|
p({ type: Boolean })
|
|
722
767
|
], n.prototype, "excludeTypes", 2);
|
|
723
|
-
|
|
768
|
+
h([
|
|
724
769
|
p({ type: Boolean })
|
|
725
770
|
], n.prototype, "exhaustiveReverseGeocoding", 2);
|
|
726
|
-
|
|
771
|
+
h([
|
|
727
772
|
p({ type: Boolean })
|
|
728
773
|
], n.prototype, "fetchFullGeometryOnPick", 2);
|
|
729
|
-
|
|
774
|
+
h([
|
|
730
775
|
p({ type: Object })
|
|
731
776
|
], n.prototype, "fetchParameters", 2);
|
|
732
|
-
|
|
777
|
+
h([
|
|
733
778
|
p({ attribute: !1 })
|
|
734
779
|
], n.prototype, "filter", 2);
|
|
735
|
-
|
|
780
|
+
h([
|
|
736
781
|
p({ type: Object })
|
|
737
782
|
], n.prototype, "fuzzyMatch", 2);
|
|
738
|
-
|
|
783
|
+
h([
|
|
739
784
|
p({ type: String })
|
|
740
785
|
], n.prototype, "iconsBaseUrl", 2);
|
|
741
|
-
|
|
786
|
+
h([
|
|
742
787
|
p({ type: Boolean })
|
|
743
788
|
], n.prototype, "keepListOpen", 2);
|
|
744
|
-
|
|
789
|
+
h([
|
|
745
790
|
p({ attribute: !1 })
|
|
746
791
|
], n.prototype, "language", 2);
|
|
747
|
-
|
|
792
|
+
h([
|
|
748
793
|
p({ type: Number })
|
|
749
794
|
], n.prototype, "limit", 2);
|
|
750
|
-
|
|
795
|
+
h([
|
|
751
796
|
p({ type: Number })
|
|
752
797
|
], n.prototype, "minLength", 2);
|
|
753
|
-
|
|
798
|
+
h([
|
|
754
799
|
p({ type: String })
|
|
755
800
|
], n.prototype, "noResultsMessage", 2);
|
|
756
|
-
|
|
801
|
+
h([
|
|
757
802
|
p({ type: Boolean })
|
|
758
803
|
], n.prototype, "openListOnTop", 2);
|
|
759
|
-
|
|
804
|
+
h([
|
|
760
805
|
p({ type: String })
|
|
761
806
|
], n.prototype, "placeholder", 2);
|
|
762
|
-
|
|
807
|
+
h([
|
|
763
808
|
p({ type: Array })
|
|
764
809
|
], n.prototype, "proximity", 2);
|
|
765
|
-
|
|
810
|
+
h([
|
|
766
811
|
p({ type: Boolean })
|
|
767
812
|
], n.prototype, "reverseActive", 2);
|
|
768
|
-
|
|
813
|
+
h([
|
|
769
814
|
p({ type: String })
|
|
770
815
|
], n.prototype, "reverseButtonTitle", 2);
|
|
771
|
-
|
|
816
|
+
h([
|
|
772
817
|
p({ type: Object })
|
|
773
818
|
], n.prototype, "reverseGeocodingExcludeTypes", 2);
|
|
774
|
-
|
|
819
|
+
h([
|
|
775
820
|
p({ type: Number })
|
|
776
821
|
], n.prototype, "reverseGeocodingLimit", 2);
|
|
777
|
-
|
|
822
|
+
h([
|
|
778
823
|
p({ type: Array })
|
|
779
824
|
], n.prototype, "reverseGeocodingTypes", 2);
|
|
780
|
-
|
|
825
|
+
h([
|
|
781
826
|
p({ type: Object })
|
|
782
827
|
], n.prototype, "selectFirst", 2);
|
|
783
|
-
|
|
828
|
+
h([
|
|
784
829
|
p({ type: String })
|
|
785
830
|
], n.prototype, "showPlaceType", 2);
|
|
786
|
-
|
|
831
|
+
h([
|
|
787
832
|
p({ type: Object })
|
|
788
833
|
], n.prototype, "showResultsWhileTyping", 2);
|
|
789
|
-
|
|
834
|
+
h([
|
|
790
835
|
p({ type: Array })
|
|
791
836
|
], n.prototype, "types", 2);
|
|
792
|
-
|
|
837
|
+
h([
|
|
793
838
|
p({ type: String })
|
|
794
839
|
], n.prototype, "worldview", 2);
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
], n.prototype, "
|
|
798
|
-
|
|
799
|
-
|
|
840
|
+
h([
|
|
841
|
+
L({ slot: "content", flatten: !1 })
|
|
842
|
+
], n.prototype, "contentSlotElements", 2);
|
|
843
|
+
h([
|
|
844
|
+
L({ slot: "input", flatten: !0, selector: we })
|
|
845
|
+
], n.prototype, "inputSlotElements", 2);
|
|
846
|
+
h([
|
|
847
|
+
L({ slot: "search-button", flatten: !0, selector: X })
|
|
848
|
+
], n.prototype, "searchButtonElements", 2);
|
|
849
|
+
h([
|
|
850
|
+
L({ slot: "clear-button", flatten: !0, selector: X })
|
|
851
|
+
], n.prototype, "clearButtonElements", 2);
|
|
852
|
+
h([
|
|
853
|
+
L({ slot: "reverse-button", flatten: !0, selector: X })
|
|
854
|
+
], n.prototype, "reverseButtonElements", 2);
|
|
855
|
+
h([
|
|
856
|
+
L({ slot: "clear-error-button", flatten: !0, selector: X })
|
|
857
|
+
], n.prototype, "clearErrorButtonElements", 2);
|
|
858
|
+
h([
|
|
859
|
+
L({ slot: "search-icon", flatten: !0 })
|
|
860
|
+
], n.prototype, "searchIconElements", 2);
|
|
861
|
+
h([
|
|
862
|
+
L({ slot: "clear-icon", flatten: !0 })
|
|
863
|
+
], n.prototype, "clearIconElements", 2);
|
|
864
|
+
h([
|
|
865
|
+
L({ slot: "reverse-icon", flatten: !0 })
|
|
866
|
+
], n.prototype, "reverseIconElements", 2);
|
|
867
|
+
h([
|
|
868
|
+
L({ slot: "clear-error-icon", flatten: !0 })
|
|
869
|
+
], n.prototype, "clearErrorIconElements", 2);
|
|
870
|
+
h([
|
|
871
|
+
x()
|
|
800
872
|
], n.prototype, "searchValue", 2);
|
|
801
|
-
|
|
802
|
-
|
|
873
|
+
h([
|
|
874
|
+
x()
|
|
803
875
|
], n.prototype, "listFeatures", 2);
|
|
804
|
-
|
|
805
|
-
|
|
876
|
+
h([
|
|
877
|
+
x()
|
|
806
878
|
], n.prototype, "selectedItemIndex", 2);
|
|
807
|
-
|
|
808
|
-
|
|
879
|
+
h([
|
|
880
|
+
x()
|
|
809
881
|
], n.prototype, "picked", 2);
|
|
810
|
-
|
|
811
|
-
|
|
882
|
+
h([
|
|
883
|
+
x()
|
|
812
884
|
], n.prototype, "cachedFeatures", 2);
|
|
813
|
-
|
|
814
|
-
|
|
885
|
+
h([
|
|
886
|
+
x()
|
|
815
887
|
], n.prototype, "lastSearchUrl", 2);
|
|
816
|
-
|
|
817
|
-
|
|
888
|
+
h([
|
|
889
|
+
x()
|
|
818
890
|
], n.prototype, "error", 2);
|
|
819
|
-
|
|
820
|
-
|
|
891
|
+
h([
|
|
892
|
+
x()
|
|
821
893
|
], n.prototype, "abortController", 2);
|
|
822
|
-
|
|
823
|
-
|
|
894
|
+
h([
|
|
895
|
+
x()
|
|
824
896
|
], n.prototype, "focused", 2);
|
|
825
|
-
|
|
826
|
-
|
|
897
|
+
h([
|
|
898
|
+
x()
|
|
827
899
|
], n.prototype, "isFeatureListVisible", 2);
|
|
828
|
-
|
|
829
|
-
|
|
900
|
+
h([
|
|
901
|
+
x()
|
|
830
902
|
], n.prototype, "isFeatureListInteractedWith", 2);
|
|
831
|
-
n =
|
|
832
|
-
|
|
903
|
+
n = h([
|
|
904
|
+
T("maptiler-geocoder")
|
|
833
905
|
], n);
|
|
834
|
-
const
|
|
906
|
+
const Lt = [
|
|
835
907
|
"adjustUrl",
|
|
836
908
|
"apiKey",
|
|
837
909
|
"apiUrl",
|
|
@@ -869,15 +941,15 @@ const yt = [
|
|
|
869
941
|
"types",
|
|
870
942
|
"reverseGeocodingTypes",
|
|
871
943
|
"worldview"
|
|
872
|
-
],
|
|
873
|
-
var
|
|
874
|
-
for (var s = a > 1 ? void 0 : a ?
|
|
944
|
+
], It = "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)}";
|
|
945
|
+
var $t = Object.getOwnPropertyDescriptor, Et = (t, e, i, a) => {
|
|
946
|
+
for (var s = a > 1 ? void 0 : a ? $t(e, i) : e, o = t.length - 1, r; o >= 0; o--)
|
|
875
947
|
(r = t[o]) && (s = r(s) || s);
|
|
876
948
|
return s;
|
|
877
949
|
};
|
|
878
|
-
let
|
|
950
|
+
let de = class extends F {
|
|
879
951
|
render() {
|
|
880
|
-
return
|
|
952
|
+
return D`
|
|
881
953
|
<svg
|
|
882
954
|
viewBox="0 0 70 85"
|
|
883
955
|
fill="none"
|
|
@@ -891,17 +963,17 @@ let ne = class extends F {
|
|
|
891
963
|
`;
|
|
892
964
|
}
|
|
893
965
|
};
|
|
894
|
-
|
|
895
|
-
${
|
|
966
|
+
de.styles = O`
|
|
967
|
+
${ue(It)}
|
|
896
968
|
`;
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
],
|
|
900
|
-
const
|
|
901
|
-
function
|
|
902
|
-
const e =
|
|
903
|
-
|
|
904
|
-
|
|
969
|
+
de = Et([
|
|
970
|
+
T("maptiler-geocode-marker")
|
|
971
|
+
], de);
|
|
972
|
+
const Ot = "@maptiler/geocoding-control", Ft = "3.1.0-rc.1";
|
|
973
|
+
function $e(t) {
|
|
974
|
+
const e = st(
|
|
975
|
+
Z([
|
|
976
|
+
tt([
|
|
905
977
|
[
|
|
906
978
|
[180, 90],
|
|
907
979
|
[-180, 90],
|
|
@@ -916,22 +988,22 @@ function we(t) {
|
|
|
916
988
|
if (!e)
|
|
917
989
|
return;
|
|
918
990
|
e.properties = { isMask: !0 };
|
|
919
|
-
const i =
|
|
991
|
+
const i = K(Ie(t)), a = (i[2] - i[0]) / 360 / 1e3, s = i[0] < -180, o = i[2] > 180, r = rt(t);
|
|
920
992
|
if (r.features.length > 1 && (s || o))
|
|
921
993
|
for (const u of r.features) {
|
|
922
|
-
const y =
|
|
994
|
+
const y = K(Ie(u));
|
|
923
995
|
if (o && y[0] < -180 + a)
|
|
924
996
|
for (const M of u.geometry.coordinates)
|
|
925
|
-
for (const
|
|
926
|
-
|
|
997
|
+
for (const _ of M)
|
|
998
|
+
_[0] += 360 - a;
|
|
927
999
|
if (s && y[2] > 180 - a)
|
|
928
1000
|
for (const M of u.geometry.coordinates)
|
|
929
|
-
for (const
|
|
930
|
-
|
|
1001
|
+
for (const _ of M)
|
|
1002
|
+
_[0] -= 360 - a;
|
|
931
1003
|
}
|
|
932
|
-
return
|
|
1004
|
+
return Z([r.features.length < 2 ? t : Fe(r) ?? t, e]);
|
|
933
1005
|
}
|
|
934
|
-
const
|
|
1006
|
+
const Tt = {
|
|
935
1007
|
continental_marine: 4,
|
|
936
1008
|
country: 4,
|
|
937
1009
|
major_landform: 8,
|
|
@@ -955,7 +1027,7 @@ const Lt = {
|
|
|
955
1027
|
"poi.restaurant": 18,
|
|
956
1028
|
"poi.aerodrome": 13
|
|
957
1029
|
// TODO add many more
|
|
958
|
-
},
|
|
1030
|
+
}, Mt = {
|
|
959
1031
|
fill: {
|
|
960
1032
|
paint: {
|
|
961
1033
|
"fill-color": "#000",
|
|
@@ -974,8 +1046,8 @@ const Lt = {
|
|
|
974
1046
|
},
|
|
975
1047
|
filter: ["!", ["has", "isMask"]]
|
|
976
1048
|
}
|
|
977
|
-
},
|
|
978
|
-
class
|
|
1049
|
+
}, N = "mtlr-gc-full-geom", Ee = "mtlr-gc-full-geom-fill", Oe = "mtlr-gc-full-geom-line";
|
|
1050
|
+
class St extends te.Evented {
|
|
979
1051
|
#e = {};
|
|
980
1052
|
#t;
|
|
981
1053
|
#i;
|
|
@@ -990,7 +1062,7 @@ class $t extends H.Evented {
|
|
|
990
1062
|
}
|
|
991
1063
|
/** @internal Not to be called directly */
|
|
992
1064
|
onRemove() {
|
|
993
|
-
this.#
|
|
1065
|
+
this.#_(), this.#t = void 0, this.#i = void 0;
|
|
994
1066
|
}
|
|
995
1067
|
getOptions() {
|
|
996
1068
|
return { ...this.#e };
|
|
@@ -1051,11 +1123,11 @@ class $t extends H.Evented {
|
|
|
1051
1123
|
},
|
|
1052
1124
|
select: (e) => {
|
|
1053
1125
|
const i = e.detail.feature;
|
|
1054
|
-
i && this.#d && this.#e.flyToSelected && this.#
|
|
1126
|
+
i && this.#d && this.#e.flyToSelected && this.#b(i.center, this.#h(i)), this.#o && i && this.#O(i), this.#s("select", e.detail);
|
|
1055
1127
|
},
|
|
1056
1128
|
pick: (e) => {
|
|
1057
1129
|
const i = e.detail.feature;
|
|
1058
|
-
i && i.id !== this.#m && this.#d && (this.#
|
|
1130
|
+
i && i.id !== this.#m && this.#d && (this.#L(i), this.#p(this.#o, i)), this.#m = i?.id, this.#s("pick", e.detail);
|
|
1059
1131
|
},
|
|
1060
1132
|
featuresshow: () => {
|
|
1061
1133
|
this.#s("featuresshow");
|
|
@@ -1065,7 +1137,7 @@ class $t extends H.Evented {
|
|
|
1065
1137
|
},
|
|
1066
1138
|
featureslisted: (e) => {
|
|
1067
1139
|
const i = e.detail.features;
|
|
1068
|
-
this.#o = i, this.#p(this.#o, void 0), this
|
|
1140
|
+
this.#o = i, this.#p(this.#o, void 0), this.#I(e), this.#s("featureslisted", e.detail);
|
|
1069
1141
|
},
|
|
1070
1142
|
featuresclear: () => {
|
|
1071
1143
|
this.#o = void 0, this.#p(void 0, void 0), this.#s("featuresclear");
|
|
@@ -1102,7 +1174,7 @@ class $t extends H.Evented {
|
|
|
1102
1174
|
this.#t.on(e, i);
|
|
1103
1175
|
}
|
|
1104
1176
|
}
|
|
1105
|
-
#
|
|
1177
|
+
#_() {
|
|
1106
1178
|
if (!(!this.#i || !this.#t)) {
|
|
1107
1179
|
for (const [e, i] of Object.entries(this.#g))
|
|
1108
1180
|
this.#i.removeEventListener(e, i);
|
|
@@ -1113,22 +1185,22 @@ class $t extends H.Evented {
|
|
|
1113
1185
|
#s(e, i) {
|
|
1114
1186
|
return super.fire({ type: e, ...i ?? {} });
|
|
1115
1187
|
}
|
|
1116
|
-
#
|
|
1117
|
-
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#
|
|
1188
|
+
#L(e) {
|
|
1189
|
+
e.bbox[0] === e.bbox[2] && e.bbox[1] === e.bbox[3] ? this.#b(e.center, this.#h(e)) : this.#x(K(e.bbox), 50, this.#h(e));
|
|
1118
1190
|
}
|
|
1119
|
-
|
|
1191
|
+
#I({ detail: { features: e, external: i } }) {
|
|
1120
1192
|
if (!e || e.length === 0 || !this.#d || this.#e.flyToFeatures === !1 || this.#e.flyToFeatures === "never" || !i && (this.#e.flyToFeatures === void 0 || this.#e.flyToFeatures === "external"))
|
|
1121
1193
|
return;
|
|
1122
1194
|
const a = e.every((r) => r.matching_text), s = e.reduce(
|
|
1123
1195
|
(r, u) => a || !u.matching_text ? [Math.min(r[0], u.bbox[0]), Math.min(r[1], u.bbox[1]), Math.max(r[2], u.bbox[2]), Math.max(r[3], u.bbox[3])] : r,
|
|
1124
1196
|
[180, 90, -180, -90]
|
|
1125
1197
|
), o = e.map((r) => this.#h(r)).filter((r) => r !== void 0).reduce((r, u) => r === void 0 ? u : Math.max(r, u), void 0);
|
|
1126
|
-
this.#
|
|
1198
|
+
this.#x(K(s), 50, o);
|
|
1127
1199
|
}
|
|
1128
1200
|
#h(e) {
|
|
1129
1201
|
if (e.bbox[0] !== e.bbox[2] || e.bbox[1] !== e.bbox[3])
|
|
1130
1202
|
return;
|
|
1131
|
-
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ??
|
|
1203
|
+
const i = e.id.replace(/\..*/, ""), a = this.#e.zoom ?? Tt;
|
|
1132
1204
|
return (Array.isArray(e.properties?.categories) ? e.properties.categories.reduce((s, o) => {
|
|
1133
1205
|
const r = a[i + "." + o];
|
|
1134
1206
|
return s === void 0 ? r : r === void 0 ? s : Math.max(s, r);
|
|
@@ -1137,22 +1209,22 @@ class $t extends H.Evented {
|
|
|
1137
1209
|
get #d() {
|
|
1138
1210
|
return !!this.#e.flyTo || this.#e.flyTo === void 0;
|
|
1139
1211
|
}
|
|
1140
|
-
get
|
|
1212
|
+
get #$() {
|
|
1141
1213
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1142
1214
|
}
|
|
1143
|
-
get #
|
|
1215
|
+
get #E() {
|
|
1144
1216
|
return typeof this.#e.flyTo == "boolean" ? {} : this.#e.flyTo;
|
|
1145
1217
|
}
|
|
1146
|
-
#
|
|
1147
|
-
this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this
|
|
1218
|
+
#b(e, i) {
|
|
1219
|
+
this.#t?.flyTo({ center: e, ...i ? { zoom: i } : {}, ...this.#$ });
|
|
1148
1220
|
}
|
|
1149
|
-
#
|
|
1221
|
+
#x(e, i, a) {
|
|
1150
1222
|
this.#t?.fitBounds(
|
|
1151
1223
|
[
|
|
1152
1224
|
[e[0], e[1]],
|
|
1153
1225
|
[e[2], e[3]]
|
|
1154
1226
|
],
|
|
1155
|
-
{ padding: i, ...a ? { maxZoom: a } : {}, ...this.#
|
|
1227
|
+
{ padding: i, ...a ? { maxZoom: a } : {}, ...this.#E }
|
|
1156
1228
|
);
|
|
1157
1229
|
}
|
|
1158
1230
|
#w(e) {
|
|
@@ -1180,9 +1252,9 @@ class $t extends H.Evented {
|
|
|
1180
1252
|
(o) => o.type === "Polygon" || o.type === "MultiPolygon"
|
|
1181
1253
|
);
|
|
1182
1254
|
if (s.length > 0) {
|
|
1183
|
-
const o =
|
|
1255
|
+
const o = Fe(Z(s.map((r) => it(r))));
|
|
1184
1256
|
if (o) {
|
|
1185
|
-
const r =
|
|
1257
|
+
const r = $e({ ...i, geometry: o.geometry });
|
|
1186
1258
|
r && this.#n(r);
|
|
1187
1259
|
}
|
|
1188
1260
|
} else {
|
|
@@ -1195,7 +1267,7 @@ class $t extends H.Evented {
|
|
|
1195
1267
|
});
|
|
1196
1268
|
}
|
|
1197
1269
|
} else if (i?.geometry.type.endsWith("Polygon")) {
|
|
1198
|
-
const s =
|
|
1270
|
+
const s = $e(i);
|
|
1199
1271
|
s && this.#n(s), this.#e.pickedResultStyle === "full-geometry-including-polygon-center-marker" && a();
|
|
1200
1272
|
} else i?.geometry.type.endsWith("LineString") ? this.#n(i) : i?.geometry.type.endsWith("Point") && a();
|
|
1201
1273
|
if (this.#e.showResultMarkers !== !1 && this.#e.showResultMarkers !== null)
|
|
@@ -1208,7 +1280,7 @@ class $t extends H.Evented {
|
|
|
1208
1280
|
continue;
|
|
1209
1281
|
} else
|
|
1210
1282
|
o = this.#f(this.#e.showResultMarkers).setLngLat(s.center).setPopup(
|
|
1211
|
-
new
|
|
1283
|
+
new te.Popup({
|
|
1212
1284
|
offset: [1, -27],
|
|
1213
1285
|
closeButton: !1,
|
|
1214
1286
|
closeOnMove: !0,
|
|
@@ -1229,49 +1301,49 @@ class $t extends H.Evented {
|
|
|
1229
1301
|
this.#c?.getElement().classList.toggle("marker-selected", !1), this.#c = void 0, this.#e.markerOnSelected !== !1 && (this.#c = this.#l.get(e), this.#c?.getElement().classList.toggle("marker-selected", !0));
|
|
1230
1302
|
}
|
|
1231
1303
|
#u() {
|
|
1232
|
-
if (!this.#t?.
|
|
1304
|
+
if (!this.#t?._loaded) {
|
|
1233
1305
|
this.#t?.once("load", () => {
|
|
1234
1306
|
this.#u();
|
|
1235
1307
|
});
|
|
1236
1308
|
return;
|
|
1237
1309
|
}
|
|
1238
|
-
const e = this.#
|
|
1239
|
-
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ??
|
|
1310
|
+
const e = this.#F(), i = this.#t.getSource(N);
|
|
1311
|
+
!e?.fill && !e?.line || !i && !this.#a || (i ? i.setData(this.#a ?? Z([])) : this.#a && this.#t.addSource(N, {
|
|
1240
1312
|
type: "geojson",
|
|
1241
1313
|
data: this.#a
|
|
1242
|
-
}), !this.#t.getLayer(
|
|
1314
|
+
}), !this.#t.getLayer(Ee) && e.fill && this.#t.addLayer({
|
|
1243
1315
|
...e.fill,
|
|
1244
|
-
id:
|
|
1316
|
+
id: Ee,
|
|
1245
1317
|
type: "fill",
|
|
1246
|
-
source:
|
|
1247
|
-
}), !this.#t.getLayer(
|
|
1318
|
+
source: N
|
|
1319
|
+
}), !this.#t.getLayer(Oe) && e.line && this.#t.addLayer({
|
|
1248
1320
|
...e.line,
|
|
1249
|
-
id:
|
|
1321
|
+
id: Oe,
|
|
1250
1322
|
type: "line",
|
|
1251
|
-
source:
|
|
1323
|
+
source: N
|
|
1252
1324
|
}));
|
|
1253
1325
|
}
|
|
1254
1326
|
#n(e) {
|
|
1255
1327
|
this.#a = e, this.#u();
|
|
1256
1328
|
}
|
|
1257
1329
|
#f(e) {
|
|
1258
|
-
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new
|
|
1330
|
+
return typeof e != "object" && (e = { element: this.#t?._container.ownerDocument.createElement("maptiler-geocode-marker"), offset: [1, -13] }), new te.Marker(e);
|
|
1259
1331
|
}
|
|
1260
|
-
#
|
|
1332
|
+
#F() {
|
|
1261
1333
|
const { fullGeometryStyle: e } = this.#e;
|
|
1262
|
-
if (e === !0 || e === void 0) return
|
|
1334
|
+
if (e === !0 || e === void 0) return Mt;
|
|
1263
1335
|
if (!(e === !1 || e === null))
|
|
1264
1336
|
return e;
|
|
1265
1337
|
}
|
|
1266
1338
|
}
|
|
1267
|
-
class
|
|
1339
|
+
class Zt extends St {
|
|
1268
1340
|
#e;
|
|
1269
1341
|
constructor(e = {}) {
|
|
1270
1342
|
super(e);
|
|
1271
1343
|
}
|
|
1272
1344
|
/** @internal Not to be called directly */
|
|
1273
1345
|
onAdd(e) {
|
|
1274
|
-
this.#e = e, e.telemetry.registerModule(
|
|
1346
|
+
this.#e = e, e.telemetry.registerModule(Ot, Ft);
|
|
1275
1347
|
const i = this.getOptions(), { primaryLanguage: a, apiKey: s } = e.getSdkConfig();
|
|
1276
1348
|
if (i.apiKey === void 0 && this.setOptions({ apiKey: s }), i.language === void 0) {
|
|
1277
1349
|
const r = a.code?.match(/^([a-z]{2,3})($|_|-)/);
|
|
@@ -1291,25 +1363,25 @@ class jt extends $t {
|
|
|
1291
1363
|
adjustUrl: (a) => {
|
|
1292
1364
|
i?.(a);
|
|
1293
1365
|
const s = this.getOptions();
|
|
1294
|
-
(
|
|
1366
|
+
(et.session ? e.session !== !1 : e.session === !0) && this.#e && (!s.apiUrl || new URL(s.apiUrl).host === new URL("https://api.maptiler.com/geocoding").host) && a.searchParams.append("mtsid", this.#e.getMaptilerSessionId());
|
|
1295
1367
|
}
|
|
1296
1368
|
});
|
|
1297
1369
|
}
|
|
1298
1370
|
}
|
|
1299
1371
|
export {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1372
|
+
Mt as DEFAULT_GEOMETRY_STYLE,
|
|
1373
|
+
Zt as GeocodingControl,
|
|
1374
|
+
se as MaptilerGeocodeClearIconElement,
|
|
1375
|
+
re as MaptilerGeocodeFailIconElement,
|
|
1376
|
+
oe as MaptilerGeocodeLoadingIconElement,
|
|
1377
|
+
de as MaptilerGeocodeMarkerElement,
|
|
1378
|
+
ae as MaptilerGeocodeReverseGeocodingIconElement,
|
|
1379
|
+
le as MaptilerGeocodeSearchIconElement,
|
|
1308
1380
|
n as MaptilerGeocoderElement,
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1381
|
+
Zt as MaptilerGeocodingControl,
|
|
1382
|
+
Ee as RESULT_LAYER_FILL,
|
|
1383
|
+
Oe as RESULT_LAYER_LINE,
|
|
1384
|
+
N as RESULT_SOURCE,
|
|
1385
|
+
Tt as ZOOM_DEFAULTS
|
|
1314
1386
|
};
|
|
1315
1387
|
//# sourceMappingURL=maptilersdk.js.map
|