multi-map-engine 1.0.0
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/LICENSE +21 -0
- package/README.md +300 -0
- package/dist/index.js +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# multi-map-engine
|
|
2
|
+
|
|
3
|
+
> 统一API的多地图引擎适配框架,支持Leaflet、OpenLayers、Cesium无缝切换
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- **统一API**: 一套代码适配多个地图引擎
|
|
8
|
+
- **无缝切换**: 只需修改一行代码即可切换引擎
|
|
9
|
+
- **完整支持**: 支持Leaflet(2D)、OpenLayers(2D)、Cesium(3D)
|
|
10
|
+
- **TypeScript友好**: 提供完整的类型定义
|
|
11
|
+
- **轻量级**: 外部化依赖,按需引入
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install multi-map-engine
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
还需要安装对应的地图引擎:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install leaflet ol cesium
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 快速开始
|
|
26
|
+
|
|
27
|
+
### 使用 Leaflet
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
import { MapFactory } from 'multi-map-engine';
|
|
31
|
+
import 'leaflet/dist/leaflet.css';
|
|
32
|
+
|
|
33
|
+
const engine = MapFactory.create('leaflet');
|
|
34
|
+
|
|
35
|
+
engine.createMap('map', {
|
|
36
|
+
lng: 117.1205,
|
|
37
|
+
lat: 36.6509,
|
|
38
|
+
zoom: 12
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
engine.addLayer({
|
|
42
|
+
id: 'base-layer',
|
|
43
|
+
type: 'tile',
|
|
44
|
+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
45
|
+
attribution: '© OpenStreetMap'
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 切换到 OpenLayers
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { MapFactory } from 'multi-map-engine';
|
|
53
|
+
import 'ol/ol.css';
|
|
54
|
+
|
|
55
|
+
// 只需改一行!
|
|
56
|
+
const engine = MapFactory.create('openlayers');
|
|
57
|
+
|
|
58
|
+
// 其他代码完全一样
|
|
59
|
+
engine.createMap('map', {
|
|
60
|
+
lng: 117.1205,
|
|
61
|
+
lat: 36.6509,
|
|
62
|
+
zoom: 12
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 切换到 Cesium 3D
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { MapFactory } from 'multi-map-engine';
|
|
70
|
+
|
|
71
|
+
// 切换到 3D 地球 - 还是一样!
|
|
72
|
+
const engine = MapFactory.create('cesium');
|
|
73
|
+
|
|
74
|
+
engine.createMap('map', {
|
|
75
|
+
lng: 117.1205,
|
|
76
|
+
lat: 36.6509,
|
|
77
|
+
zoom: 12
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 浏览器直接使用
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<!DOCTYPE html>
|
|
85
|
+
<html>
|
|
86
|
+
<head>
|
|
87
|
+
<meta charset="UTF-8">
|
|
88
|
+
<title>multi-map-engine</title>
|
|
89
|
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
|
90
|
+
<style>
|
|
91
|
+
#map { width: 100%; height: 100vh; }
|
|
92
|
+
</style>
|
|
93
|
+
</head>
|
|
94
|
+
<body>
|
|
95
|
+
<div id="map"></div>
|
|
96
|
+
|
|
97
|
+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
|
98
|
+
<script type="module">
|
|
99
|
+
import { MapFactory } from 'https://unpkg.com/multi-map-engine@1.0.0/dist/index.js';
|
|
100
|
+
|
|
101
|
+
const engine = MapFactory.create('leaflet');
|
|
102
|
+
engine.createMap('map', {
|
|
103
|
+
lng: 117.1205,
|
|
104
|
+
lat: 36.6509,
|
|
105
|
+
zoom: 12
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
engine.addLayer({
|
|
109
|
+
id: 'osm',
|
|
110
|
+
type: 'tile',
|
|
111
|
+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// 监听点击事件
|
|
115
|
+
engine.on('click', (e) => {
|
|
116
|
+
console.log('点击了地图:', e);
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
119
|
+
</body>
|
|
120
|
+
</html>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## API 文档
|
|
124
|
+
|
|
125
|
+
### MapFactory
|
|
126
|
+
|
|
127
|
+
工厂类,用于创建地图引擎实例。
|
|
128
|
+
|
|
129
|
+
#### create(engineType)
|
|
130
|
+
|
|
131
|
+
创建地图引擎实例。
|
|
132
|
+
|
|
133
|
+
**参数:**
|
|
134
|
+
- `engineType` (string|MapEngineType): 引擎类型
|
|
135
|
+
- `'leaflet'` - Leaflet 2D地图
|
|
136
|
+
- `'openlayers'` - OpenLayers 2D地图
|
|
137
|
+
- `'cesium'` - Cesium 3D地图
|
|
138
|
+
|
|
139
|
+
**返回:** `IMapEngine` - 地图引擎实例
|
|
140
|
+
|
|
141
|
+
**示例:**
|
|
142
|
+
```javascript
|
|
143
|
+
const engine = MapFactory.create('leaflet');
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### IMapEngine
|
|
147
|
+
|
|
148
|
+
统一接口的地图引擎实例。
|
|
149
|
+
|
|
150
|
+
#### createMap(containerId, options)
|
|
151
|
+
|
|
152
|
+
创建地图。
|
|
153
|
+
|
|
154
|
+
**参数:**
|
|
155
|
+
- `containerId` (string): 容器DOM元素ID
|
|
156
|
+
- `options` (Object): 地图配置
|
|
157
|
+
- `lng` (number): 中心经度
|
|
158
|
+
- `lat` (number): 中心纬度
|
|
159
|
+
- `zoom` (number): 缩放级别
|
|
160
|
+
- `minZoom` (number): 最小缩放级别(可选)
|
|
161
|
+
- `maxZoom` (number): 最大缩放级别(可选)
|
|
162
|
+
|
|
163
|
+
#### addLayer(layerConfig)
|
|
164
|
+
|
|
165
|
+
添加图层。
|
|
166
|
+
|
|
167
|
+
**参数:**
|
|
168
|
+
- `layerConfig` (Object): 图层配置
|
|
169
|
+
- `id` (string): 图层ID
|
|
170
|
+
- `type` (string): 图层类型,支持 'tile'
|
|
171
|
+
- `url` (string): 瓦片URL
|
|
172
|
+
- `attribution` (string): 版权信息(可选)
|
|
173
|
+
|
|
174
|
+
#### setCenter(lng, lat, zoom)
|
|
175
|
+
|
|
176
|
+
设置地图中心。
|
|
177
|
+
|
|
178
|
+
**参数:**
|
|
179
|
+
- `lng` (number): 经度
|
|
180
|
+
- `lat` (number): 纬度
|
|
181
|
+
- `zoom` (number): 缩放级别(可选)
|
|
182
|
+
|
|
183
|
+
#### getBounds()
|
|
184
|
+
|
|
185
|
+
获取地图范围。
|
|
186
|
+
|
|
187
|
+
**返回:** `Object` - 范围信息
|
|
188
|
+
- `minLng` (number): 最小经度
|
|
189
|
+
- `maxLng` (number): 最大经度
|
|
190
|
+
- `minLat` (number): 最小纬度
|
|
191
|
+
- `maxLat` (number): 最大纬度
|
|
192
|
+
|
|
193
|
+
#### on(event, callback)
|
|
194
|
+
|
|
195
|
+
注册事件监听。
|
|
196
|
+
|
|
197
|
+
**参数:**
|
|
198
|
+
- `event` (string): 事件名称,支持 'click', 'mousemove' 等
|
|
199
|
+
- `callback` (Function): 回调函数
|
|
200
|
+
|
|
201
|
+
#### destroy()
|
|
202
|
+
|
|
203
|
+
销毁地图实例。
|
|
204
|
+
|
|
205
|
+
## 引擎切换示例
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
import { MapFactory, MapEngineType } from 'multi-map-engine';
|
|
209
|
+
|
|
210
|
+
// 初始化
|
|
211
|
+
let engine = MapFactory.create(MapEngineType.LEAFLET);
|
|
212
|
+
engine.createMap('map', { lng: 117.1205, lat: 36.6509, zoom: 12 });
|
|
213
|
+
|
|
214
|
+
// 添加图层
|
|
215
|
+
engine.addLayer({
|
|
216
|
+
id: 'base-layer',
|
|
217
|
+
type: 'tile',
|
|
218
|
+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// 监听事件
|
|
222
|
+
engine.on('click', (e) => {
|
|
223
|
+
console.log('地图点击:', e);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// 切换引擎(例如切换到3D)
|
|
227
|
+
function switchTo3D() {
|
|
228
|
+
engine.destroy();
|
|
229
|
+
engine = MapFactory.create(MapEngineType.CESIUM);
|
|
230
|
+
|
|
231
|
+
engine.createMap('map', { lng: 117.1205, lat: 36.6509, zoom: 12 });
|
|
232
|
+
|
|
233
|
+
engine.addLayer({
|
|
234
|
+
id: 'base-layer',
|
|
235
|
+
type: 'tile',
|
|
236
|
+
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
engine.on('click', (e) => {
|
|
240
|
+
console.log('3D地图点击:', e);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## 支持的地图引擎
|
|
246
|
+
|
|
247
|
+
### Leaflet
|
|
248
|
+
- 轻量级开源2D地图库
|
|
249
|
+
- 文档: https://leafletjs.com/
|
|
250
|
+
|
|
251
|
+
### OpenLayers
|
|
252
|
+
- 功能强大的2D地图库
|
|
253
|
+
- 文档: https://openlayers.org/
|
|
254
|
+
|
|
255
|
+
### Cesium
|
|
256
|
+
- 开源3D地球引擎
|
|
257
|
+
- 文档: https://cesium.com/
|
|
258
|
+
|
|
259
|
+
## 注意事项
|
|
260
|
+
|
|
261
|
+
### Cesium 配置
|
|
262
|
+
|
|
263
|
+
使用 Cesium 引擎时,需要确保正确配置资源路径:
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
window.CESIUM_BASE_URL = './node_modules/cesium/Build/Cesium/';
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
或在构建时配置 webpack 复制 Cesium 资源文件。
|
|
270
|
+
|
|
271
|
+
### 样式引入
|
|
272
|
+
|
|
273
|
+
不同引擎需要引入对应的CSS:
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// Leaflet
|
|
277
|
+
import 'leaflet/dist/leaflet.css';
|
|
278
|
+
|
|
279
|
+
// OpenLayers
|
|
280
|
+
import 'ol/ol.css';
|
|
281
|
+
|
|
282
|
+
// Cesium
|
|
283
|
+
import 'cesium/Build/Cesium/Widgets/widgets.css';
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## 开源协议
|
|
287
|
+
|
|
288
|
+
[MIT](LICENSE)
|
|
289
|
+
|
|
290
|
+
## 贡献
|
|
291
|
+
|
|
292
|
+
欢迎提交 Issue 和 Pull Request!
|
|
293
|
+
|
|
294
|
+
## 更新日志
|
|
295
|
+
|
|
296
|
+
### 1.0.0 (2024-XX-XX)
|
|
297
|
+
- 初始版本发布
|
|
298
|
+
- 支持 Leaflet、OpenLayers、Cesium
|
|
299
|
+
- 统一的API接口
|
|
300
|
+
- 完整的事件系统
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("leaflet"),require("ol")):"function"==typeof define&&define.amd?define(["leaflet","ol"],e):"object"==typeof exports?exports.MultiMapEngine=e(require("leaflet"),require("ol")):t.MultiMapEngine=e(t.L,t.ol)}(Object("undefined"!=typeof self?self:this),(t,e)=>(()=>{var i={167(e){"use strict";e.exports=t},260(t){t.exports=function(){"use strict";function t(t,n,s,r,o){!function t(i,n,s,r,o){for(;r>s;){if(r-s>600){var a=r-s+1,l=n-s+1,h=Math.log(a),c=.5*Math.exp(2*h/3),u=.5*Math.sqrt(h*c*(a-c)/a)*(l-a/2<0?-1:1);t(i,n,Math.max(s,Math.floor(n-l*c/a+u)),Math.min(r,Math.floor(n+(a-l)*c/a+u)),o)}var d=i[n],g=s,f=r;for(e(i,s,n),o(i[r],d)>0&&e(i,s,r);g<f;){for(e(i,g,f),g++,f--;o(i[g],d)<0;)g++;for(;o(i[f],d)>0;)f--}0===o(i[s],d)?e(i,s,f):e(i,++f,r),f<=n&&(s=f+1),n<=f&&(r=f-1)}}(t,n,s||0,r||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return t<e?-1:t>e?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function r(t,e){o(t,0,t.children.length,e,t)}function o(t,e,i,n,s){s||(s=f(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var r=e;r<i;r++){var o=t.children[r];a(s,t.leaf?n(o):o)}return s}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function h(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function u(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function g(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function f(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(e,i,n,s,r){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=s)){var a=i+Math.ceil((n-i)/s/2)*s;t(e,a,i,n,r),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!g(t,e))return i;for(var n=this.toBBox,s=[];e;){for(var r=0;r<e.children.length;r++){var o=e.children[r],a=e.leaf?n(o):o;g(t,a)&&(e.leaf?i.push(o):d(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i},n.prototype.collides=function(t){var e=this.data;if(!g(t,e))return!1;for(var i=[];e;){for(var n=0;n<e.children.length;n++){var s=e.children[n],r=e.leaf?this.toBBox(s):s;if(g(t,r)){if(e.leaf||d(t,r))return!0;i.push(s)}}e=i.pop()}return!1},n.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var n=this.data;this.data=i,i=n}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},n.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},n.prototype.clear=function(){return this.data=f([]),this},n.prototype.remove=function(t,e){if(!t)return this;for(var i,n,r,o=this.data,a=this.toBBox(t),l=[],h=[];o||l.length;){if(o||(o=l.pop(),n=l[l.length-1],i=h.pop(),r=!0),o.leaf){var c=s(t,o.children,e);if(-1!==c)return o.children.splice(c,1),l.push(o),this._condense(l),this}r||o.leaf||!d(o,a)?n?(i++,o=n.children[i],r=!1):o=null:(l.push(o),h.push(i),i=0,n=o,o=o.children[0])}return this},n.prototype.toBBox=function(t){return t},n.prototype.compareMinX=function(t,e){return t.minX-e.minX},n.prototype.compareMinY=function(t,e){return t.minY-e.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(t){return this.data=t,this},n.prototype._all=function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},n.prototype._build=function(t,e,i,n){var s,o=i-e+1,a=this._maxEntries;if(o<=a)return r(s=f(t.slice(e,i+1)),this.toBBox),s;n||(n=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,n-1))),(s=f([])).leaf=!1,s.height=n;var l=Math.ceil(o/a),h=l*Math.ceil(Math.sqrt(a));_(t,e,i,h,this.compareMinX);for(var c=e;c<=i;c+=h){var u=Math.min(c+h-1,i);_(t,c,u,l,this.compareMinY);for(var d=c;d<=u;d+=l){var g=Math.min(d+l-1,u);s.children.push(this._build(t,d,g,n-1))}}return r(s,this.toBBox),s},n.prototype._chooseSubtree=function(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){for(var s=1/0,r=1/0,o=void 0,a=0;a<e.children.length;a++){var l=e.children[a],h=c(l),u=(d=t,g=l,(Math.max(g.maxX,d.maxX)-Math.min(g.minX,d.minX))*(Math.max(g.maxY,d.maxY)-Math.min(g.minY,d.minY))-h);u<r?(r=u,s=h<s?h:s,o=l):u===r&&h<s&&(s=h,o=l)}e=o||e.children[0]}var d,g;return e},n.prototype._insert=function(t,e,i){var n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),a(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var o=this._chooseSplitIndex(i,s,n),a=f(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,r(i,this.toBBox),r(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=f([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,s,r,a,l,h,u,d=1/0,g=1/0,f=e;f<=i-e;f++){var _=o(t,0,f,this.toBBox),p=o(t,f,i,this.toBBox),m=(s=_,r=p,void 0,void 0,void 0,void 0,a=Math.max(s.minX,r.minX),l=Math.max(s.minY,r.minY),h=Math.min(s.maxX,r.maxX),u=Math.min(s.maxY,r.maxY),Math.max(0,h-a)*Math.max(0,u-l)),y=c(_)+c(p);m<d?(d=m,n=f,g=y<g?y:g):m===d&&y<g&&(g=y,n=f)}return n||i-e},n.prototype._chooseSplitAxis=function(t,e,i){var n=t.leaf?this.compareMinX:l,s=t.leaf?this.compareMinY:h;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)},n.prototype._allDistMargin=function(t,e,i,n){t.children.sort(n);for(var s=this.toBBox,r=o(t,0,e,s),l=o(t,i-e,i,s),h=u(r)+u(l),c=e;c<i-e;c++){var d=t.children[c];a(r,t.leaf?s(d):d),h+=u(r)}for(var g=i-e-1;g>=e;g--){var f=t.children[g];a(l,t.leaf?s(f):f),h+=u(l)}return h},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},n}()},660(t){"use strict";t.exports=e}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return i[t].call(r.exports,r,r.exports,s),r.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,i(s.key),s)}}function i(e){var i=function(e){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,"string");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(i)?i:i+""}s.r(r),s.d(r,{CesiumAdapter:()=>ic,IMapEngine:()=>n,LeafletAdapter:()=>f,MapEngineType:()=>oc,MapFactory:()=>ac,OpenLayersAdapter:()=>Hh,VERSION:()=>lc});var n=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(i=[{key:"createMap",value:function(t,e){throw new Error("必须实现 createMap 方法")}},{key:"addLayer",value:function(t){throw new Error("必须实现 addLayer 方法")}},{key:"removeLayer",value:function(t){throw new Error("必须实现 removeLayer 方法")}},{key:"setCenter",value:function(t,e,i){throw new Error("必须实现 setCenter 方法")}},{key:"setZoom",value:function(t){throw new Error("必须实现 setZoom 方法")}},{key:"getBounds",value:function(){throw new Error("必须实现 getBounds 方法")}},{key:"on",value:function(t,e){throw new Error("必须实现 on 方法")}},{key:"off",value:function(t,e){throw new Error("必须实现 off 方法")}},{key:"destroy",value:function(){throw new Error("必须实现 destroy 方法")}},{key:"getNativeMap",value:function(){throw new Error("必须实现 getNativeMap 方法")}}])&&e(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,i}(),o=s(167),a=s.n(o);function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function c(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=l(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}var f=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,i){return e=d(e),function(t,e){if(e&&("object"==l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,u()?Reflect.construct(e,i||[],d(t).constructor):e.apply(t,i))}(this,e)).map=null,t.layers={},t.eventHandlers={},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),i=e,(n=[{key:"createMap",value:function(t,e){var i={center:[e.lat,e.lng],zoom:e.zoom||10,minZoom:e.minZoom,maxZoom:e.maxZoom,zoomControl:!0,attributionControl:!0};return this.map=a().map(t,i),this._addDefaultBaseLayer(),this}},{key:"addLayer",value:function(t){if(!this.map)return console.warn("地图未初始化"),this;var e;switch(t.type){case"tile":e=this._createTileLayer(t);break;case"geojson":e=this._createGeoJSONLayer(t);break;default:return console.warn("不支持的图层类型:",t.type),this}return e&&(e.addTo(this.map),this.layers[t.id]=e),this}},{key:"removeLayer",value:function(t){var e=this.layers[t];return e&&this.map&&(this.map.removeLayer(e),delete this.layers[t]),this}},{key:"setCenter",value:function(t,e,i){return this.map&&this.map.setView([e,t],i),this}},{key:"setZoom",value:function(t){return this.map&&this.map.setZoom(t),this}},{key:"getBounds",value:function(){if(!this.map)return null;var t=this.map.getBounds();return{minLng:t.getWest(),maxLng:t.getEast(),minLat:t.getSouth(),maxLat:t.getNorth()}}},{key:"on",value:function(t,e){return this.map&&(this.map.on(t,e),this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)),this}},{key:"off",value:function(t,e){return this.map&&(e?this.map.off(t,e):this.map.off(t)),this}},{key:"destroy",value:function(){this.map&&(this.map.remove(),this.map=null),this.layers={},this.eventHandlers={}}},{key:"getNativeMap",value:function(){return this.map}},{key:"_addDefaultBaseLayer",value:function(){var t=a().tileLayer("https://t{s}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",{subdomains:["0","1","2","3","4","5","6","7"],attribution:"© 天地图",maxZoom:18}),e=a().tileLayer("https://t{s}.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",{subdomains:["0","1","2","3","4","5","6","7"],attribution:"© 天地图",maxZoom:18});t.addTo(this.map),e.addTo(this.map),this.layers["base-layer"]=t,this.layers["base-layer-label"]=e}},{key:"_createTileLayer",value:function(t){var e={maxZoom:t.maxZoom||18,minZoom:t.minZoom||0,attribution:t.attribution||""},i=a().tileLayer(t.url,e);return void 0!==t.opacity&&i.setOpacity(t.opacity),i}},{key:"_createGeoJSONLayer",value:function(t){return a().geoJSON(t.data||[],{style:t.style||{}})}}])&&h(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n);s(660);const _=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},p="propertychange",m=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function y(t,e){return t>e?1:t<e?-1:0}function v(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function x(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function w(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function C(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function S(){return!0}function E(){return!1}function b(){}function T(t){let e,i,n,s=!1;return function(){const r=Array.prototype.slice.call(arguments);return s&&this===n&&C(r,i)||(s=!0,n=this,i=r,e=t.apply(this,arguments)),e}}function R(t){for(const e in t)delete t[e]}function I(t){let e;for(e in t)return!1;return!e}const M=class extends m{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new _(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,b);delete r[i]}return a}disposeInternal(){this.listeners_&&R(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=b,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},P="change",L="contextmenu",F="click",k="keydown",O="keypress",A="touchmove",D="wheel";function G(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function j(t,e,i,n){return G(t,e,i,n,!0)}function z(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),R(t))}class N extends M{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=G(this,t[s],e);return n}return G(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=j(this,t[s],e)}else i=j(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)z(t[e]);else z(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}N.prototype.on,N.prototype.once,N.prototype.un;const W=N;function X(){throw new Error("Unimplemented abstract method.")}let Y=0;function B(t){return t.ol_uid||(t.ol_uid=String(++Y))}class Z extends _{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const K=class extends W{constructor(t){super(),this.on,this.once,this.un,B(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Z(i,t,e)),i=p,this.hasListener(i)&&this.dispatchEvent(new Z(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],I(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},V="add",U="remove",H="length";class q extends _{constructor(t,e,i){super(t),this.element=e,this.index=i}}const J=class extends K{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(H)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new q(V,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new q(U,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new q(U,i,t)),this.dispatchEvent(new q(V,e,t))}updateLength_(){this.set(H,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}},$="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",Q=$.includes("firefox"),tt=($.includes("safari")&&!$.includes("chrom")&&($.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test($)),$.includes("webkit")&&!$.includes("edge")),et=$.includes("macintosh"),it="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,nt="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,st="undefined"!=typeof Image&&Image.prototype.decode,rt=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function ot(t,e){if(!t)throw new Error(e)}function at(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function lt(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function ht(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;ot(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}let ct;function ut(t){const e="matrix("+t.join(", ")+")";if(nt)return e;const i=ct||(ct=document.createElement("div"));return i.style.transform=e,i.style.transform}new Array(6);function dt(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)Tt(e,t[i]);return e}function gt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function ft(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function _t(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function pt(t,e){return yt(t,e[0],e[1])}function mt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function yt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function vt(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>s&&(l|=4),a<n?l|=8:a>r&&(l|=2),0===l&&(l=1),l}function xt(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function wt(t){return xt(1/0,1/0,-1/0,-1/0,t)}function Ct(t,e){const i=t[0],n=t[1];return xt(i,n,i,n,e)}function St(t,e,i,n,s){return Rt(wt(s),t,e,i,n)}function Et(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function bt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function Tt(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function Rt(t,e,i,n,s){for(;i<n;i+=s)It(t,e[i],e[i+1]);return t}function It(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Mt(t,e){let i;return i=e(Lt(t)),i||(i=e(Ft(t)),i||(i=e(Nt(t)),i||(i=e(zt(t)),i||!1)))}function Pt(t){let e=0;return Yt(t)||(e=Wt(t)*Gt(t)),e}function Lt(t){return[t[0],t[1]]}function Ft(t){return[t[2],t[1]]}function kt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Ot(t,e){let i;if("bottom-left"===e)i=Lt(t);else if("bottom-right"===e)i=Ft(t);else if("top-left"===e)i=zt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Nt(t)}return i}function At(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=Dt(t,e,i,n);return xt(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Dt(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function Gt(t){return t[3]-t[1]}function jt(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Xt(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):wt(n),n}function zt(t){return[t[0],t[3]]}function Nt(t){return[t[2],t[3]]}function Wt(t){return t[2]-t[0]}function Xt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Yt(t){return t[2]<t[0]||t[3]<t[1]}function Bt(t,e){const i=e.getExtent(),n=kt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Wt(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}const Zt={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},Kt={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};Kt.max=Kt.whitepoint[2].D65,Kt.rgb=function(t,e){e=e||Kt.whitepoint[2].E;var i,n,s,r=t[0]/e[0],o=t[1]/e[1],a=t[2]/e[2];return n=-.96924363628087*r+1.87596750150772*o+.041555057407175*a,s=.055630079696993*r+-.20397695888897*o+1.056971514242878*a,i=(i=3.240969941904521*r+-1.537383177570093*o+-.498610760293*a)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(s=Math.min(Math.max(0,s),1))]},Zt.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,s=t[2]/255,r=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92),o=.019330818715591*i+.11919477979462*n+.95053215224966*s;return[(.41239079926595*i+.35758433938387*n+.18048078840183*s)*(e=e||Kt.whitepoint[2].E)[0],r*e[1],o*e[2]]};const Vt=Kt,Ut={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,s,r,o,a,l,h,c,u;return r=t[0],o=t[1],a=t[2],0===r?[0,0,0]:(e=e||"D65",i=i||2,n=o/(13*r)+4*(h=Vt.whitepoint[i][e][0])/(h+15*(c=Vt.whitepoint[i][e][1])+3*(u=Vt.whitepoint[i][e][2]))||0,s=a/(13*r)+9*c/(h+15*c+3*u)||0,[9*(l=r>8?c*Math.pow((r+16)/116,3):c*r*.0011070564598794539)*n/(4*s)||0,l,l*(12-3*n-20*s)/(4*s)||0])}};Vt.luv=function(t,e,i){var n,s,r,o,a,l,h,c,u,d,g;e=e||"D65",i=i||2,d=4*(h=Vt.whitepoint[i][e][0])/(h+15*(c=Vt.whitepoint[i][e][1])+3*(u=Vt.whitepoint[i][e][2])),g=9*c/(h+15*c+3*u),n=4*(o=t[0])/(o+15*(a=t[1])+3*(l=t[2]))||0,s=9*a/(o+15*a+3*l)||0;var f=a/c;return[r=f<=.008856451679035631?903.2962962962961*f:116*Math.pow(f,1/3)-16,13*r*(n-d),13*r*(s-g)]};var Ht={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return Ut.xyz(Ht.luv(t))}};const qt=Ht;Ut.lchuv=function(t){var e=t[0],i=t[1],n=t[2],s=Math.sqrt(i*i+n*n),r=360*Math.atan2(n,i)/2/Math.PI;return r<0&&(r+=360),[e,s,r]},Vt.lchuv=function(t){return Ut.lchuv(Vt.luv(t))};const Jt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(const t in Jt)Object.freeze(Jt[t]);const $t=Object.freeze(Jt);var Qt={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};const te={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,s,r,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[r=255*l,r,r];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),s=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,r=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,s[h++]=255*r;return s}};function ee(t,e,i){return Math.min(Math.max(t,e),i)}function ie(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return ne(t,e,i,n)}function ne(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function se(t){return t*Math.PI/180}function re(t,e){const i=t%e;return i*e<0?i+e:i}function oe(t,e,i){return t+i*(e-t)}function ae(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function le(t,e){return Math.floor(ae(t,e))}function he(t,e){return Math.ceil(ae(t,e))}function ce(t){return"string"==typeof t?t:ye(t)}Zt.hsl=function(t){var e,i,n=t[0]/255,s=t[1]/255,r=t[2]/255,o=Math.min(n,s,r),a=Math.max(n,s,r),l=a-o;return a===o?e=0:n===a?e=(s-r)/l:s===a?e=2+(r-n)/l:r===a&&(e=4+(n-s)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};const ue={};let de=0;function ge(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function fe(t){const e=Vt.lchuv(Zt.xyz(t));return e[3]=t[3],e}function _e(t){if(ue.hasOwnProperty(t))return ue[t];if(de>=1024){let t=0;for(const e in ue)3&t++||(delete ue[e],--de)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=function(t){var e,i,n=[],s=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),$t[t])n=$t[t].slice(),i="rgb";else if("transparent"===t)s=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var r=t.slice(1),o=r.length;s=1,o<=4?(n=[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16)],4===o&&(s=parseInt(r[3]+r[3],16)/255)):(n=[parseInt(r[0]+r[1],16),parseInt(r[2]+r[3],16),parseInt(r[4]+r[5],16)],8===o&&(s=parseInt(r[6]+r[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),s=(n=n.map(function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==Qt[t])return Qt[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)})).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:s}}(t);if(!i.space)return[];const n="h"===i.space[0]?te.min:Zt.min,s="h"===i.space[0]?te.max:Zt.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],n[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],n[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],n[2]),s[2]),"h"===i.space[0]&&(e=te.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return me(e),ue[t]=e,++de,e}function pe(t){return Array.isArray(t)?t:_e(t)}function me(t){return t[0]=ee(t[0]+.5|0,0,255),t[1]=ee(t[1]+.5|0,0,255),t[2]=ee(t[2]+.5|0,0,255),t[3]=ee(t[3],0,1),t}function ye(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}function ve(t,e,i){return e+":"+t+":"+(i?ce(i):"null")}const xe=new class{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ve(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=ve(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}},we="opacity",Ce="visible",Se="extent",Ee="zIndex",be="maxResolution",Te="minResolution",Re="maxZoom",Ie="minZoom",Me="source",Pe=class extends K{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[we]=void 0!==t.opacity?t.opacity:1,ot("number"==typeof e[we],"Layer opacity must be a number"),e[Ce]=void 0===t.visible||t.visible,e[Ee]=t.zIndex,e[be]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Te]=void 0!==t.minResolution?t.minResolution:0,e[Ie]=void 0!==t.minZoom?t.minZoom:-1/0,e[Re]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=ee(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return X()}getLayerStatesArray(t){return X()}getExtent(){return this.get(Se)}getMaxResolution(){return this.get(be)}getMinResolution(){return this.get(Te)}getMinZoom(){return this.get(Ie)}getMaxZoom(){return this.get(Re)}getOpacity(){return this.get(we)}getSourceState(){return X()}getVisible(){return this.get(Ce)}getZIndex(){return this.get(Ee)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Se,t)}setMaxResolution(t){this.set(be,t)}setMinResolution(t){this.set(Te,t)}setMaxZoom(t){this.set(Re,t)}setMinZoom(t){this.set(Ie,t)}setOpacity(t){ot("number"==typeof t,"Layer opacity must be a number"),this.set(we,t)}setVisible(t){this.set(Ce,t)}setZIndex(t){this.set(Ee,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Le="prerender",Fe="postrender",ke="precompose",Oe="rendercomplete",Ae={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},De={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Ge=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||De[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},je=6378137,ze=Math.PI*je,Ne=[-ze,-ze,ze,ze],We=[-180,-85,180,85],Xe=je*Math.log(Math.tan(Math.PI/2));class Ye extends Ge{constructor(t){super({code:t,units:"m",extent:Ne,global:!0,worldExtent:We,getPointResolution:function(t,e){return t/Math.cosh(e[1]/je)}})}}const Be=[new Ye("EPSG:3857"),new Ye("EPSG:102100"),new Ye("EPSG:102113"),new Ye("EPSG:900913"),new Ye("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ye("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Ze=[-180,-90,180,90],Ke=6378137*Math.PI/180;class Ve extends Ge{constructor(t,e){super({code:t,units:"degrees",extent:Ze,axisOrientation:e,global:!0,metersPerUnit:Ke,worldExtent:Ze})}}const Ue=[new Ve("CRS:84"),new Ve("EPSG:4326","neu"),new Ve("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ve("urn:ogc:def:crs:OGC:2:84"),new Ve("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ve("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ve("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let He={},qe={};function Je(t,e,i){const n=t.getCode(),s=e.getCode();n in qe||(qe[n]={}),qe[n][s]=i}function $e(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Qe(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function ti(t,e){if(e.canWrapX()){const i=Wt(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Wt(n),s=Math.floor((t[0]-n[0])/i)),s}(t,e,i);n&&(t[0]-=n*i)}return t}function ei(t,e,i){i=i||6371008.8;const n=se(t[1]),s=se(e[1]),r=(s-n)/2,o=se(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const ii=2;let ni=1;function si(...t){ni>ii||console.warn(...t)}let ri=!0;function oi(t){ri=!(void 0===t||t)}function ai(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function li(t,e){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function hi(t){!function(t,e){He[t]=e}(t.getCode(),t),Je(t,t,ai)}function ci(t){return"string"==typeof t?He[e=t]||He[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null:t||null;var e}function ui(t,e,i,n){let s;const r=(t=ci(t)).getPointResolutionFunc();if(r){if(s=r(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(s=s*e/De[n])}}else{const r=t.getUnits();if("degrees"==r&&!n||"degrees"==n)s=e;else{const o=pi(t,ci("EPSG:4326"));if(o===li&&"degrees"!==r)s=e*t.getMetersPerUnit();else{let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),s=(ei(t.slice(0,2),t.slice(2,4))+ei(t.slice(4,6),t.slice(6,8)))/2}const a=n?De[n]:t.getMetersPerUnit();void 0!==a&&(s/=a)}}return s}function di(t){!function(t){t.forEach(hi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&Je(e,t,ai)})})}function gi(t,e){return t?"string"==typeof t?ci(t):t:ci(e)}function fi(t,e){return oi(),yi(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function _i(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||pi(t,e)===ai)&&i}function pi(t,e){let i=function(t,e){let i;return t in qe&&e in qe[t]&&(i=qe[t][e]),i}(t.getCode(),e.getCode());return i||(i=li),i}function mi(t,e){return pi(ci(t),ci(e))}function yi(t,e,i){return mi(e,i)(t,void 0,t.length)}function vi(t,e,i,n){return function(t,e,i,n){if(Yt(t))return wt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return xt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}(t,mi(e,i),void 0,n)}let xi=null;function wi(){return xi}function Ci(t,e){return t}function Si(t,e){return ri&&!$e(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(ri=!1,si("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Ei(t,e){return t}function bi(t,e){return t}function Ti(t,e){return t}var Ri,Ii,Mi;function Pi(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,_=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=ee(n[0],d,g),m=ee(n[1],f,_);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-_)/t)}return[p,m]}}function Li(t){return t}function Fi(t,e,i,n){const s=Wt(e)/i[0],r=Gt(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function ki(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),ee(n,i/2,2*e)}function Oi(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?Fi(t,n,a,s):t;return i&&l?ki(r,o,e):ee(r,e,o)}}}function Ai(t){if(void 0!==t)return 0}function Di(t){if(void 0!==t)return t}function Gi(t){return Math.pow(t,3)}function ji(t){return 1-Gi(1-t)}function zi(t){return 3*t*t-2*t*t*t}function Ni(t){return t}function Wi(t,e,i,n,s,r){r=r||[];let o=0;for(let a=e;a<i;a+=n){const e=t[a],i=t[a+1];r[o++]=s[0]*e+s[2]*i+s[4],r[o++]=s[1]*e+s[3]*i+s[5]}return r&&r.length!=o&&(r.length=o),r}function Xi(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}di(Be),di(Ue),Ri=Be,Ii=function(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s<n;s+=i){e[s]=ze*t[s]/180;let i=je*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));i>Xe?i=Xe:i<-Xe&&(i=-Xe),e[s+1]=i}return e},Mi=function(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s<n;s+=i)e[s]=180*t[s]/ze,e[s+1]=360*Math.atan(Math.exp(t[s+1]/je))/Math.PI-90;return e},Ue.forEach(function(t){Ri.forEach(function(e){Je(t,e,Ii),Je(e,t,Mi)})});const Yi=[1,0,0,1,0,0],Bi=class extends K{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=T((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return X()}closestPointXY(t,e,i,n){return X()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return X()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&wt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){X()}scale(t,e,i){X()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return X()}getType(){return X()}applyTransform(t){X()}intersectsExtent(t){return X()}translate(t,e){X()}transform(t,e){const i=ci(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=Gt(o)/Gt(r);return lt(Yi,o[0],o[3],a,-a,0,0,0),Wi(t,0,t.length,s,Yi,n),mi(i,e)(t,n,s)}:mi(i,e);return this.applyTransform(n),this}};function Zi(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Ki(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const Vi=class extends Bi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return St(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return X()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Ki(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){X()}setLayout(t,e,i){let n;if(t)n=Ki(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=Zi(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Xi(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=kt(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[c++]=l+s*i,a[c++]=h+r*o;for(let i=e+2;i<e+n;++i)a[c++]=t[i]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+s,o[a++]=t[e+1]+r;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function Ui(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=oe(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function Hi(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=ne(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function qi(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Hi(t,e,o,n,s),e=o}return s}function Ji(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=ne(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Ui(t,g-n,g,n,o,a,c),d=ne(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Ui(t,i-n,e,n,o,a,c),d=ne(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function $i(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Ji(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function Qi(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function tn(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Qi(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}function en(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=tn(t,e,i[o],n,s[r]);0===a.length&&(a[0]=e),s[r++]=a,e=a[a.length-1]}return s.length=r,s}function nn(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=ie(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function sn(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=nn(t,e,h,n,s,r,o),a.push(o),e=h}return o}function rn(t,e){return e*Math.round(t/e)}function on(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=rn(t[e],s),c=rn(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=rn(t[e],s),l=rn(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=rn(t[e],s),u=rn(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function an(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=on(t,e,h,n,s,r,o),a.push(o),e=h}return o}function ln(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function hn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=ln(t,e,a,n,s[r]),e=a}return s.length=r,s}function cn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:hn(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}function un(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=o*i-r*n,r=i,o=n}return s/2}function dn(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=un(t,e,o,n),e=o}return s}class gn extends Vi{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new gn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<_t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ji(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return un(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ln(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=nn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new gn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qi(this.flatCoordinates,0,t,this.stride),this.changed()}}const fn=gn;class _n extends Vi{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new _n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=ne(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Ct(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return yt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const pn=_n;function mn(t,e,i,n,s){return!Mt(s,function(s){return!yn(t,e,i,n,s[0],s[1])})}function yn(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function vn(t,e,i,n,s,r){if(0===i.length)return!1;if(!yn(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(yn(t,i[e-1],i[e],n,s,r))return!1;return!0}function xn(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],_=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,_.push(h)),c=u,d=g}let p=NaN,m=-1/0;for(_.sort(y),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,vn(t,e,i,n,h,f)&&(p=h,m=s)),c=u}return isNaN(p)&&(p=s[r]),o?(o.push(p,f,m),o):[p,f,m]}function wn(t,e,i,n,s){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=xn(t,e,a,n,s,2*o,r),e=a[a.length-1]}return r}function Cn(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function Sn(t,e,i,n,s){const r=Rt([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!Xt(s,r)&&(!!mt(s,r)||r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||Cn(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=vt(t,e),r=vt(t,i);if(1===s||1===r)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let _,p;2&r&&!(2&s)&&(_=d-(g-h)/f,n=_>=o&&_<=l),n||!(4&r)||4&s||(p=g-(d-l)*f,n=p>=a&&p<=h),n||!(8&r)||8&s||(_=d-(g-a)/f,n=_>=o&&_<=l),n||!(16&r)||16&s||(p=g-(d-o)*f,n=p>=a&&p<=h)}return n}(s,t,e)}))}function En(t,e,i,n,s){return!!(Sn(t,e,i,n,s)||yn(t,e,i,n,s[0],s[1])||yn(t,e,i,n,s[0],s[3])||yn(t,e,i,n,s[2],s[1])||yn(t,e,i,n,s[2],s[3]))}function bn(t,e,i,n,s){if(!En(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(mn(t,i[e-1],i[e],n,s)&&!Sn(t,i[e-1],i[e],n,s))return!1;return!0}function Tn(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function Rn(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function In(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Rn(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function Mn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!In(t,e,o,n,s))return!1;o.length&&(e=o[o.length-1])}return!0}function Pn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Rn(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&Tn(t,e,o,n),e=o}return e}function Ln(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=Pn(t,e,i[r],n,s);return e}class Fn extends Vi{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?w(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Fn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<_t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$i(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return vn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return dn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Pn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,hn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=kt(this.getExtent());this.flatInteriorPoint_=xn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new pn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new fn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new fn(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;In(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Pn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=an(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Fn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return bn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=tn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const kn=Fn;function On(t){if(Yt(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new Fn(r,"XY",[r.length])}function An(t,e){setTimeout(function(){t(e)},0)}function Dn(t){return!(t.sourceCenter&&t.targetCenter&&!$e(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function Gn(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*r-l*o,l*r+a*o]}const jn=class extends K{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=gi(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&oi(),t.center&&(t.center=Si(t.center,this.projection_)),t.extent&&(t.extent=bi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in Ae)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let s=void 0!==t.minZoom?t.minZoom:0,r=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,c=gi(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,g=t.extent;if(a||g||!c.isGlobal()||(d=!1,g=u),void 0!==t.resolutions){const o=t.resolutions;i=o[s],n=void 0!==o[r]?o[r]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?Fi(l,i,o,n):l;if(a)return e?ki(s,c,h):ee(s,h,c);const u=Math.min(c,s),d=Math.floor(v(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&g,h):Oi(i,n,l,!d&&g,h)}else{const a=(u?Math.max(Wt(u),Gt(u)):360*De.degrees/c.getMetersPerUnit())/256/Math.pow(2,0),f=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?s=0:i=a/Math.pow(o,s),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,r):a/Math.pow(o,r):f),r=s+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,r-s),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?Fi(e,s,l,r):e;if(h)return n?ki(o,c,i):ee(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(e/f)/Math.log(t)+g),p=Math.max(d,_);return ee(e/Math.pow(t,p),i,c)}}}(o,i,n,l,!d&&g,h):Oi(i,n,l,!d&&g,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:s,zoomFactor:o}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Pi(t.extent,t.constrainOnlyCenter,e)}const e=gi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Pi(t,!1,!1)}return Li}(t),s=i.constraint,r=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=se(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?Di:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):Di}return Ai}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Si(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Si(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&An(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||zi,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=re(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Dn(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&An(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?re(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&An(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,r;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Qe(i,t-this.getRotation()),r=e,(s=i)[0]+=+r[0],s[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();return void 0!==n&&void 0!==s&&(i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ci(t,this.getProjection()):t}getCenterInternal(){return this.get(Ae.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Ei(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();ot(e,"The view center is not defined");const i=this.getResolution();ot(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return ot(void 0!==n,"The view rotation is not defined"),At(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Ae.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(bi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Wt(t)/e[0],n=Gt(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(Ae.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Gn(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=v(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=ee(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ee(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(ot(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))ot(!Yt(t),"Cannot fit empty extent provided as `geometry`"),i=On(bi(t,this.getProjection()));else if("Circle"===t.getType()){const e=bi(t.getExtent(),this.getProjection());i=On(e),i.rotate(this.getRotation(),kt(e))}else{const e=wi();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=kt(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:b;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),An(_,!0))}centerOn(t,e,i){this.centerOnInternal(Si(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Gn(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Gn(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Ci(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Si(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Si(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Si(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(Ae.ROTATION)!==n&&this.set(Ae.ROTATION,n),this.get(Ae.RESOLUTION)!==r&&(this.set(Ae.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(Ae.CENTER)&&$e(this.get(Ae.CENTER),o)||this.set(Ae.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&$e(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:ji,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&Si(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}};function zn(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const Nn=class extends Pe{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Me,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Me)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(z(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=G(t,P,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof jn?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find(t=>t.layer===this):this.getLayerState();const s=this.getExtent();return zn(n,e.viewState)&&(!s||Xt(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof jn?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(z(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(z(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=G(t,ke,function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ot(!e.some(function(t){return t.layer===i.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)},this),this.mapRenderKey_=G(this,P,t.render,t),this.changed())}setSource(t){this.set(Me,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function Wn(t,e){xe.expire()}const Xn=class extends m{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){X()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;lt(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),ht(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let l;const h=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=h.projection,d=ti(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=Wt(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,_=f.length,p=[],m=[];for(let n=0;n<g.length;n++)for(let s=_-1;s>=0;--s){const r=f[s],u=r.layer;if(u.hasRenderer()&&zn(r,h)&&o.call(a,u)){const s=u.getRenderer(),o=u.getSource();if(s&&o){const a=o.getWrapX()?d:t,h=c.bind(null,r.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],l=s.forEachFeatureAtCoordinate(m,e,i,h,p)}if(l)return l}}if(0===p.length)return;const y=1/p.length;return p.forEach((t,e)=>t.distanceSq+=e*y),p.sort((t,e)=>t.distanceSq-e.distanceSq),p.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,S,this,s,r)}getMap(){return this.map_}renderFrame(t){X()}flushDeclutterItems(t){}scheduleExpireIconCache(t){xe.canExpireCache()&&t.postRenderFunctions.push(Wn)}},Yn=class extends _{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},Bn="ol-hidden",Zn="ol-unselectable",Kn="ol-control",Vn="ol-collapsed",Un=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),Hn=["style","variant","weight","size","lineHeight","family"],qn=function(t){const e=t.match(Un);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=Hn.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Hn[t]]=n)}return i.families=i.family.split(/,\s?/),i};function Jn(t,e,i,n){let s;return s=i&&i.length?i.shift():nt?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}function $n(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Qn(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function ts(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}const es="10px sans-serif",is="#000",ns="round",ss=[],rs="round",os="#000",as="center",ls="middle",hs=[0,0,0,0],cs=new K;let us,ds=null;const gs={},fs=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let s,r;function o(s,o,a){let l=!0;for(let h=0;h<i;++h){const i=e[h];if(r=ms(s+" "+o+" "+t+i,n),a!=i){const e=ms(s+" "+o+" "+t+a+","+i,n);l=l&&e!=r}}return!!l}function a(){let t=!0;const e=cs.getKeys();for(let i=0,n=e.length;i<n;++i){const n=e[i];cs.get(n)<100&&(o.apply(this,n.split("\n"))?(R(gs),ds=null,us=void 0,cs.set(n,100)):(cs.set(n,cs.get(n)+1,!0),t=!1))}t&&(clearInterval(s),s=void 0)}return function(t){const e=qn(t);if(!e)return;const i=e.families;for(let t=0,n=i.length;t<n;++t){const n=i[t],r=e.style+"\n"+e.weight+"\n"+n;void 0===cs.get(r)&&(cs.set(r,100,!0),o(e.style,e.weight,n)||(cs.set(r,0,!0),void 0===s&&(s=setInterval(a,32))))}}}(),_s=function(){let t;return function(e){let i=gs[e];if(null==i){if(nt){const t=qn(e),n=ps(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);gs[e]=i}return i}}();function ps(t,e){return ds||(ds=Jn(1,1)),t!=us&&(ds.font=t,us=ds.font),ds.measureText(e)}function ms(t,e){return ps(t,e).width}function ys(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,ms(t,i)),0);return i[e]=n,n}const vs=class extends Xn{constructor(t){super(t),this.fontChangeListenerKey_=G(cs,p,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Zn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Yn(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){z(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(ke,t);const e=t.layerStatesArray.sort(function(t,e){return t.zIndex-e.zIndex}),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let s=null;for(let r=0,o=e.length;r<o;++r){const o=e[r];t.layerIndex=r;const a=o.layer,l=a.getSourceState();if(!zn(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,s);h&&(h!==s&&(this.children_.push(h),s=h),"getDeclutter"in a&&n.push(a))}this.flushDeclutterItems(t),function(t,e){const i=t.childNodes;for(let n=0;;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}(this.element_,this.children_),this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let i=e.length-1;i>=0;--i)e[i].renderDeclutter(t);e.length=0}};class xs extends _{constructor(t,e){super(t),this.layer=e}}const ws="layers";class Cs extends Pe{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ws,this.handleLayersChanged_),i?Array.isArray(i)?i=new J(i.slice(),{unique:!0}):ot("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new J(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(z),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(G(t,V,this.handleLayersAdd_,this),G(t,U,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(z);R(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new xs("addlayer",i))}this.changed()}registerLayerListeners_(t){const e=[G(t,p,this.handleLayerChange_,this),G(t,P,this.handleLayerChange_,this)];t instanceof Cs&&e.push(G(t,"addlayer",this.handleLayerGroupAdd_,this),G(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[B(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new xs("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new xs("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new xs("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=B(e);this.listenerKeys_[i].forEach(z),delete this.listenerKeys_[i],this.dispatchEvent(new xs("removelayer",e)),this.changed()}getLayers(){return this.get(ws)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new xs("removelayer",t[e]))}this.set(ws,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=jt(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=s)}return e}getSourceState(){return"ready"}}const Ss=Cs,Es=class extends _{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},bs=class extends Es{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Ts={SINGLECLICK:"singleclick",CLICK:F,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Rs="pointerdown",Is=class extends M{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=G(i,Rs,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=G(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(A,this.boundHandleTouchMove_,!!rt&&{passive:!1})}emulateClick_(t){let e=new bs(Ts.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new bs(Ts.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new bs(Ts.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Ts.POINTERUP||e.type==Ts.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Ts.POINTERDOWN&&e.type!=Ts.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new bs(Ts.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(z),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new bs(Ts.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(G(t,Ts.POINTERMOVE,this.handlePointerMove_,this),G(t,Ts.POINTERUP,this.handlePointerUp_,this),G(this.element_,Ts.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(G(this.element_.getRootNode(),Ts.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new bs(Ts.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new bs(Ts.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(z(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(A,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(z(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(z),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Ms="postrender",Ps="loadstart",Ls="loadend",Fs="layergroup",ks="size",Os="target",As="view",Ds=1/0,Gs=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,R(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){ot(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ds&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;for(;t<n>>1;){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,s=i[e],r=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o<s;++o)r=e[o],a=t(r),a==Ds?delete this.queuedElements_[this.keyFunction_(r)]:(i[n]=a,e[n++]=r);e.length=n,i.length=n,this.heapify_()}},js=class extends Gs{constructor(t,e){super(function(e){return t.apply(null,e)},function(t){return t[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(P,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(2===i||3===i||4===i){3!==i&&e.removeEventListener(P,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i,n,s,r=0;for(;this.tilesLoading_<t&&r<e&&this.getCount()>0;)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),0!==i||s in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++r,n.load())}},zs=class extends K{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){ts(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&ts(this.element);for(let t=0,e=this.listenerKeys.length;t<e;++t)z(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==b&&this.listenerKeys.push(G(t,Ms,this.render,this)),t.render())}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},Ns=class extends zs{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof s?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=r):this.collapseLabel_=s;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(F,this.handleClick_.bind(this),!1);const l=e+" "+Zn+" "+Kn+(this.collapsed_&&this.collapsible_?" "+Vn:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(e=>e.getAttributions(t)))),i=!this.getMap().getAllLayers().some(t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible());return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!C(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Vn),this.collapsed_?Qn(this.collapseLabel_,this.label_):Qn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},Ws=class extends zs{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.label_),r.addEventListener(F,this.handleClick_.bind(this),!1);const o=e+" "+Zn+" "+Kn,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Bn)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:ji}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Bn);t||0!==i?t&&0!==i&&this.element.classList.remove(Bn):this.element.classList.add(Bn)}this.label_.style.transform=t}this.rotation_=i}},Xs=class extends zs{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof r?document.createTextNode(r):r),h.addEventListener(F,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(F,this.handleClick_.bind(this,-i),!1);const u=e+" "+Zn+" "+Kn,d=this.element;d.className=u,d.appendChild(h),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ji})):e.setZoom(n)}}};function Ys(t){t=t||{};const e=new J;return(void 0===t.zoom||t.zoom)&&e.push(new Xs(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new Ws(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new Ns(t.attributionOptions)),e}const Bs="active";function Zs(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ji})}const Ks=class extends K{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Bs)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Bs,t)}setMap(t){this.map_=t}},Vs=class extends Ks{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Ts.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;Zs(n.getView(),r,s,this.duration_),i.preventDefault(),e=!0}return!e}};function Us(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return{clientX:i/e,clientY:n/e}}const Hs=class extends Ks{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Ts.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Ts.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Ts.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Ts.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function qs(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s&&(i=i&&e[n](t),i);++n);return i}}const Js=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},$s=function(t){return!t.map.getTargetElement().hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=t.map.getOwnerDocument().activeElement;return e.contains(i)}(t)},Qs=S,tr=function(t){const e=t.originalEvent;return 0==e.button&&!(tt&&et&&e.ctrlKey)},er=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},ir=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},nr=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},sr=function(t){const e=t.originalEvent;return ot(void 0!==e,"mapBrowserEvent must originate from a pointer event"),"mouse"==e.pointerType},rr=function(t){const e=t.originalEvent;return ot(void 0!==e,"mapBrowserEvent must originate from a pointer event"),e.isPrimary&&0===e.button},or=class extends Hs{constructor(t){super({stopDown:E}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:qs(er,rr);this.condition_=t.onFocusOnly?qs($s,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Us(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();s=e,r=i.getResolution(),s[0]*=r,s[1]*=r,Qe(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var s,r;this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),s=i.getCenterInternal(),r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ji})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},ar=class extends Hs{constructor(t){t=t||{},super({stopDown:E}),this.condition_=t.condition?t.condition:Js,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!sr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Ai)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){return!sr(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!sr(t)&&(!(!tr(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},lr=class extends m{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new kn([i])}getGeometry(){return this.geometry_}};class hr extends _{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const cr=class extends Hs{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new lr(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:tr,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new hr("boxdrag",t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new hr(e?"boxend":"boxcancel",t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new hr("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}},ur=class extends cr{constructor(t){super({condition:(t=t||{}).condition?t.condition:ir,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),s=e.getResolution()/n;i=i.clone(),i.scale(s*s)}e.fitInternal(i,{duration:this.duration_,easing:ji})}},dr="ArrowLeft",gr="ArrowRight",fr="ArrowDown",_r=class extends Ks{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return er(t)&&nr(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==k){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==fr||n==dr||n==gr||"ArrowUp"==n)){const s=t.map.getView(),r=s.getResolution()*this.pixelDelta_;let o=0,a=0;n==fr?a=-r:n==dr?o=-r:n==gr?o=r:a=r;const l=[o,a];Qe(l,s.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Ni,center:t.getConstrainedCenter(s)})}}(s,l,this.duration_),i.preventDefault(),e=!0}}return!e}},pr=class extends Ks{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return et?e.metaKey:e.ctrlKey}(t)&&nr(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==k||t.type==O){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_;Zs(s.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},mr=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},yr=class extends Ks{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Qs;this.condition_=t.onFocusOnly?qs($s,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==D)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==D&&(n=i.deltaY,Q&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=it),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.lastDelta_=n;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const r=e.getView();if("trackpad"===this.mode_&&!r.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=s,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-ee(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Zs(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},vr=class extends Hs{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=E),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==Ai&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(Us(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},xr=class extends Hs{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=E),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Us(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function wr(t){return t[0]>0&&t[1]>0}function Cr(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}function Sr(t){t instanceof Nn?t.setMapInternal(null):t instanceof Ss&&t.getLayers().forEach(Sr)}function Er(t,e){if(t instanceof Nn)t.setMapInternal(e);else if(t instanceof Ss){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Er(i[t],e)}}const br=class extends K{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Ss({layers:t.layers});let s,r,o;return i[Fs]=n,i[Os]=t.target,i[As]=t.view instanceof jn?t.view:new jn,void 0!==t.controls&&(Array.isArray(t.controls)?s=new J(t.controls.slice()):(ot("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new J(t.interactions.slice()):(ot("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new J(t.overlays.slice()):(ot("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new J,{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:it,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Ys(),this.interactions=e.interactions||function(t){t=t||{};const e=new J,i=new mr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new ar),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Vs({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new or({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new vr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new xr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new _r),e.push(new pr({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new yr({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new ur({duration:t.zoomDuration})),e}({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new js(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Fs,this.handleLayerGroupChanged_),this.addChangeListener(As,this.handleViewChanged_),this.addChangeListener(ks,this.handleSizeChanged_),this.addChangeListener(Os,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof jn||t.view.then(function(t){i.setView(new jn(t))}),this.controls.addEventListener(V,t=>{t.element.setMap(this)}),this.controls.addEventListener(U,t=>{t.element.setMap(null)}),this.interactions.addEventListener(V,t=>{t.element.setMap(this)}),this.interactions.addEventListener(U,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(V,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(U,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Er(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:S,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof Ss?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:S,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],s=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/n,(r.clientY-e.top)/s]}getTarget(){return this.get(Os)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ci(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?at(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Fs)}setLayers(t){const e=this.getLayerGroup();if(t instanceof J)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Si(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?at(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ks)}getView(){return this.get(As)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return Ds;if(!t.wantedTiles[i][e.getKey()])return Ds;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new bs(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Rs||i===D||i===k){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target;if(this.overlayContainerStopEvent_.contains(n)||!(i===t?t.documentElement:i).contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[0]||e[1]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(!0===this.renderComplete_?(this.hasListener(Oe)&&this.renderer_.dispatchRenderEvent(Oe,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Es(Ls,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Es(Ps,this,t))));const i=this.postRenderFunctions_;for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)z(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(L,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,ts(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new vs(this)),this.mapBrowserEventHandler_=new Is(this,this.moveTolerance_);for(const t in Ts)this.mapBrowserEventHandler_.addEventListener(Ts[t],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(L,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D,this.boundHandleBrowserEvent_,!!rt&&{passive:!1});const t=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[G(t,k,this.handleBrowserEvent,this),G(t,O,this.handleBrowserEvent,this)];const i=e.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.observe(i.host),this.resizeObserver_.observe(e)}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(z(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(z(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=G(t,p,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=G(t,P,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(z),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new xs("addlayer",t)),this.layerGroupPropertyListenerKeys_=[G(t,p,this.render,this),G(t,P,this.render,this),G(t,"addlayer",this.handleLayerAdd_,this),G(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Sr(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let s=null;if(void 0!==e&&wr(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:At(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:n,wantedTiles:{},mapId:B(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;s.nextExtent=At(r.nextCenter,r.nextResolution,t,e)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),n&&(!this.previousExtent_||!Yt(this.previousExtent_)&&!Et(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Es("movestart",this,n)),this.previousExtent_=wt(this.previousExtent_)),this.previousExtent_&&!s.viewHints[0]&&!s.viewHints[1]&&!Et(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Es("moveend",this,s)),ft(s.extent,this.previousExtent_))),this.dispatchEvent(new Es(Ms,this,s)),this.renderComplete_=this.hasListener(Ps)||this.hasListener(Ls)||this.hasListener(Oe)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new xs("removelayer",e)),this.set(Fs,t)}setSize(t){this.set(ks,t)}setTarget(t){this.set(Os,t)}setView(t){if(!t||t instanceof jn)return void this.set(As,t);this.set(As,new jn);const e=this;t.then(function(t){e.setView(new jn(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),s=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(s)||(e=[n,s],!wr(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&si("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&C(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}},Tr="preload",Rr="useInterimTilesOnError",Ir=class extends Nn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(Tr)}setPreload(t){this.set(Tr,t)}getUseInterimTilesOnError(){return this.get(Rr)}setUseInterimTilesOnError(t){this.set(Rr,t)}getData(t){return super.getData(t)}},Mr=class extends W{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return X()}getData(t){return null}prepareFrame(t){return X()}renderFrame(t,e){return X()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,s)=>{const r=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,r)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(P,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}},Pr=[];let Lr=null;const Fr=class extends Mr{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;Lr||(Lr=Jn(1,1,void 0,{willReadFrequently:!0})),Lr.clearRect(0,0,1,1);try{Lr.drawImage(t,e,i,1,1,0,0,1,1),n=Lr.getImageData(0,0,1,1).data}catch(t){return Lr=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&C(pe(t.style.backgroundColor),pe(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=Jn();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=zt(i),s=Nt(i),r=Ft(i),o=Lt(i);at(e.coordinateToPixelTransform,n),at(e.coordinateToPixelTransform,s),at(e.coordinateToPixelTransform,r),at(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;at(a,n),at(a,s),at(a,r),at(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Yn(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Le,t,e)}postRender(t,e){this.dispatchRenderEvent_(Fe,t,e)}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return lt(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},kr=class extends M{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(P)}release(){3===this.state&&this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let t=this.interimTile;if(!t)return this;do{if(2==t.getState())return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){let t=this.interimTile;if(!t)return;let e=this;do{if(2==t.getState()){t.interimTile=null;break}1==t.getState()?e=t:0==t.getState()?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){X()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:Gi(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}};const Or=class extends kr{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=Jn(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4,this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let s=!0,r=!1,o=!1;const a=[j(n,"load",function(){o=!0,r||e()})];return n.src&&st?(r=!0,n.decode().then(function(){s&&e()}).catch(function(t){s&&(o?e():i())})):a.push(j(n,"error",i)),function(){s=!1,a.forEach(z)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}},Ar=class{constructor(t,e,i,n,s,r){this.sourceProj_=t,this.targetProj_=e;let o={};const a=mi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Wt(n)>=Wt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Wt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Wt(this.targetProj_.getExtent()):null;const l=zt(i),h=Nt(i),c=Ft(i),u=Lt(i),d=this.transformInv_(l),g=this.transformInv_(h),f=this.transformInv_(c),_=this.transformInv_(u),p=10+(r?Math.max(0,Math.ceil(Math.log2(Pt(i)/(r*r*256*256)))):0);if(this.addQuad_(l,h,c,u,d,g,f,_,p),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}o={}}addTriangle_(t,e,i,n,s,r){this.triangles_.push({source:[n,s,r],target:[t,e,i]})}addQuad_(t,e,i,n,s,r,o,a,l){const h=dt([s,r,o,a]),c=this.sourceWorldWidth_?Wt(h)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(g=Wt(dt([t,e,i,n]))/this.targetWorldWidth_>.25||g),!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)),!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Xt(h,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(f=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;r=d?(re(s[0],u)+re(o[0],u))/2-re(n[0],u):(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,s,r,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,s,c,d,a,l-1),this.addQuad_(h,e,i,u,c,r,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,n,s,o,a),14&f||this.addTriangle_(t,i,e,s,o,r),f&&(13&f||this.addTriangle_(e,n,t,r,a,s),7&f||this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const s=e.source;Tt(t,s[0]),Tt(t,s[1]),Tt(t,s[2])}),t}getTriangles(){return this.triangles_}};let Dr;const Gr=[];function jr(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function zr(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Nr(t,e,i,n){const s=yi(i,e,t);let r=ui(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const l=t.getExtent();if(!l||pt(l,s)){const e=ui(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}const Wr=class extends kr{constructor(t,e,i,n,s,r,o,a,l,h,c,u){super(s,0,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=g?jt(d,g):d;if(0===Pt(_))return void(this.state=4);const p=t.getExtent();p&&(f=f?jt(f,p):p);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const s=kt(i);let r=Nr(t,e,s,n);return(!isFinite(r)||r<=0)&&Mt(i,function(i){return r=Nr(t,e,i,n),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=4);const v=void 0!==h?h:.5;if(this.triangulation_=new Ar(t,i,_,f,y*v,m),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(y);let x=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(x[1]=ee(x[1],f[1],f[3]),x[3]=ee(x[3],f[1],f[3])):x=jt(x,f)),Pt(x)){const t=e.getTileRangeForExtentAndZ(x,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=l(this.sourceZ_,e,i,o);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&2==e.getState()&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,s,r,o,a,l,h,c,u,d){const g=Jn(Math.round(i*t),Math.round(i*e),Gr);if(u||(g.imageSmoothingEnabled=!1),0===l.length)return g.canvas;function f(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const _=[1/0,1/0,-1/0,-1/0];let p;if(l.forEach(function(t,e,i){bt(_,t.extent)}),!d||1!==l.length||0!==h){const t=Wt(_),e=Gt(_);p=Jn(Math.round(i*t/n),Math.round(i*e/n),Gr),u||(p.imageSmoothingEnabled=!1);const s=i/n;l.forEach(function(t,e,i){const n=t.extent[0]-_[0],r=-(t.extent[3]-_[3]),o=Wt(t.extent),a=Gt(t.extent);t.image.width>0&&t.image.height>0&&p.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*s,r*s,o*s,a*s)})}const m=zt(o);return a.getTriangles().forEach(function(t,e,s){const o=t.source,a=t.target;let h=o[0][0],c=o[0][1],d=o[1][0],y=o[1][1],v=o[2][0],x=o[2][1];const w=f((a[0][0]-m[0])/r),C=f(-(a[0][1]-m[1])/r),S=f((a[1][0]-m[0])/r),E=f(-(a[1][1]-m[1])/r),b=f((a[2][0]-m[0])/r),T=f(-(a[2][1]-m[1])/r),R=h,I=c;h=0,c=0,d-=R,y-=I,v-=R,x-=I;const M=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,s=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>s&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n<e;n++){const s=-t[n][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[n][r]=0:t[n][r]+=s*t[i][r]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}([[d,y,0,0,S-w],[v,x,0,0,b-w],[0,0,d,y,E-C],[0,0,v,x,T-C]]);if(!M)return;if(g.save(),g.beginPath(),function(){if(void 0===Dr){const t=Jn(6,6,Gr);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",jr(t,4,5,4,0),jr(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Dr=zr(e,0)||zr(e,4)||zr(e,8),$n(t),Gr.push(t.canvas)}return Dr}()||!u){g.moveTo(S,E);const t=4,e=w-S,i=C-E;for(let n=0;n<t;n++)g.lineTo(S+f((n+1)*e/t),E+f(n*i/(t-1))),n!=t-1&&g.lineTo(S+f((n+1)*e/t),E+f((n+1)*i/(t-1)));g.lineTo(b,T)}else g.moveTo(S,E),g.lineTo(w,C),g.lineTo(b,T);let P;if(g.clip(),g.transform(M[0],M[2],M[1],M[3],w,C),g.translate(_[0]-R,_[3]-I),p)P=p.canvas,g.scale(n/i,-n/i);else{const t=l[0],e=t.extent;P=t.image,g.scale(Wt(e)/P.width,-Gt(e)/P.height)}g.drawImage(P,0,0),g.restore()}),p&&($n(p),Gr.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,s=(n[0][0]-m[0])/r,o=-(n[0][1]-m[1])/r,a=(n[1][0]-m[0])/r,l=-(n[1][1]-m[1])/r,h=(n[2][0]-m[0])/r,c=-(n[2][1]-m[1])/r;g.beginPath(),g.moveTo(a,l),g.lineTo(s,o),g.lineTo(h,c),g.closePath(),g.stroke()}),g.restore()),g.canvas}(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.getState();if(0==i||1==i){t++;const i=G(e,P,function(n){const s=e.getState();2!=s&&3!=s&&4!=s||(z(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,e,i){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(z),this.sourcesListenerKeys_=null}release(){this.canvas_&&($n(this.canvas_.getContext("2d")),Gr.push(this.canvas_),this.canvas_=null),super.release()}};class Xr{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Yr(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new Xr(t,e,i,n)}const Br=Xr,Zr=class extends Fr{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new Br(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return 2==i||4==i||3==i&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer();let a=o.getSource().getTile(t,e,i,s,r);return 3==a.getState()&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(a)||(a=a.getInterimTile()),a}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=at(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!pt(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,a=e.viewState,l=i.getRenderSource(),h=l.getTileGridForProjection(a.projection),c=l.getTilePixelRatio(e.pixelRatio);for(let t=h.getZForResolution(a.resolution);t>=h.getMinZoom();--t){const e=h.getTileCoordForCoordAndZ(n,t),i=l.getTile(t,e[1],e[2],r,o);if(!(i instanceof Or||i instanceof Wr)||i instanceof Wr&&4===i.getState())return null;if(2!==i.getState())continue;const s=h.getOrigin(t),u=Cr(h.getTileSize(t)),d=h.getResolution(t),g=Math.floor(c*((n[0]-s[0])/d-e[1]*u[0])),f=Math.floor(c*((s[1]-n[1])/d-e[2]*u[1])),_=Math.round(c*l.getGutterForProjection(a.projection));return this.getImageData(i.getImage(),g+_,f+_)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=n.rotation,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getRevision(),d=c.getTileGridForProjection(s),g=d.getZForResolution(r,c.zDirection),f=d.getResolution(g);let _=t.extent;const p=t.viewState.resolution,m=c.getTilePixelRatio(l),v=Math.round(Wt(_)/p*l),x=Math.round(Gt(_)/p*l),w=i.extent&&bi(i.extent);w&&(_=jt(_,bi(i.extent)));const C=f*v/2/m,S=f*x/2/m,E=[o[0]-C,o[1]-S,o[0]+C,o[1]+S],b=d.getTileRangeForExtentAndZ(_,g),T={};T[g]={};const R=this.createLoadedTileFinder(c,s,T),I=this.tmpExtent,M=this.tmpTileRange_;this.newTiles_=!1;const P=a?Dt(n.center,p,a,t.size):void 0;for(let e=b.minX;e<=b.maxX;++e)for(let n=b.minY;n<=b.maxY;++n){if(a&&!d.tileCoordIntersectsViewport([g,e,n],P))continue;const s=this.getTile(g,e,n,t);if(this.isDrawableTile(s)){const e=B(this);if(2==s.getState()){T[g][s.tileCoord.toString()]=s;let t=s.inTransition(e);t&&1!==i.opacity&&(s.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(s)||(this.newTiles_=!0)}if(1===s.getAlpha(e,t.time))continue}const r=d.getTileCoordChildTileRange(s.tileCoord,M,I);let o=!1;r&&(o=R(g+1,r)),o||d.forEachTileCoordParentTileRange(s.tileCoord,R,M,I)}const L=f/r*l/m;lt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/l,1/l,a,-v/2,-x/2);const F=ut(this.pixelTransform);this.useContainer(e,F,this.getBackground(t));const k=this.context,O=k.canvas;ht(this.inversePixelTransform,this.pixelTransform),lt(this.tempTransform,v/2,x/2,L,L,0,-v/2,-x/2),O.width!=v||O.height!=x?(O.width=v,O.height=x):this.containerReused||k.clearRect(0,0,v,x),w&&this.clipUnrotated(k,t,w),c.getInterpolate()||(k.imageSmoothingEnabled=!1),this.preRender(k,t),this.renderedTiles.length=0;let A,D,G,j=Object.keys(T).map(Number);j.sort(y),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(A=[],D=[]):j=j.reverse();for(let e=j.length-1;e>=0;--e){const i=j[e],n=c.getTilePixelSize(i,l,s),r=d.getResolution(i)/f,o=n[0]*r*L,a=n[1]*r*L,h=d.getTileCoordForCoordAndZ(zt(E),i),u=d.getTileCoordExtent(h),_=at(this.tempTransform,[m*(u[0]-E[0])/f,m*(E[3]-u[3])/f]),p=m*c.getGutterForProjection(s),y=T[i];for(const e in y){const n=y[e],s=n.tileCoord,r=h[1]-s[1],l=Math.round(_[0]-(r-1)*o),u=h[2]-s[2],d=Math.round(_[1]-(u-1)*a),f=Math.round(_[0]-r*o),m=Math.round(_[1]-u*a),v=l-f,x=d-m,w=g===i,C=w&&1!==n.getAlpha(B(this),t.time);let S=!1;if(!C)if(A){G=[f,m,f+v,m,f+v,m+x,f,m+x];for(let t=0,e=A.length;t<e;++t)if(g!==i&&i<D[t]){const e=A[t];Xt([f,m,f+v,m+x],[e[0],e[3],e[4],e[7]])&&(S||(k.save(),S=!0),k.beginPath(),k.moveTo(G[0],G[1]),k.lineTo(G[2],G[3]),k.lineTo(G[4],G[5]),k.lineTo(G[6],G[7]),k.moveTo(e[6],e[7]),k.lineTo(e[4],e[5]),k.lineTo(e[2],e[3]),k.lineTo(e[0],e[1]),k.clip())}A.push(G),D.push(i)}else k.clearRect(f,m,v,x);this.drawTileImage(n,t,f,m,v,x,p,w),A&&!C?(S&&k.restore(),this.renderedTiles.unshift(n)):this.renderedTiles.push(n),this.updateUsedTiles(t.usedTiles,c,n)}}return this.renderedRevision=u,this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Et(this.renderedExtent_,E),this.renderedExtent_=E,this.renderedPixelRatio=l,this.renderedProjection=s,this.manageTilePyramid(t,c,d,l,s,_,g,h.getPreload()),this.scheduleExpireCache(t,c),this.postRender(k,t),i.extent&&k.restore(),k.imageSmoothingEnabled=!0,F!==O.style.transform&&(O.style.transform=F),this.container}drawTileImage(t,e,i,n,s,r,o,a){const l=this.getTileImage(t);if(!l)return;const h=B(this),c=e.layerStatesArray[e.layerIndex],u=c.opacity*(a?t.getAlpha(h,e.time):1),d=u!==this.context.globalAlpha;d&&(this.context.save(),this.context.globalAlpha=u),this.context.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,s,r),d&&this.context.restore(),u!==c.opacity?e.animate=!0:a&&t.endTransition(h)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=function(t,e,i){const n=B(t);n in i.usedTiles&&t.expireCache(i.viewState.projection,i.usedTiles[n])}.bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const n=B(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,s,r,o,a,l){const h=B(e);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=t.tileQueue,d=i.getMinZoom(),g=t.viewState.rotation,f=g?Dt(t.viewState.center,t.viewState.resolution,g,t.size):void 0;let _,p,m,y,v,x,w=0;for(x=d;x<=o;++x)for(p=i.getTileRangeForExtentAndZ(r,x,p),m=i.getResolution(x),y=p.minX;y<=p.maxX;++y)for(v=p.minY;v<=p.maxY;++v)g&&!i.tileCoordIntersectsViewport([x,y,v],f)||(o-x<=a?(++w,_=e.getTile(x,y,v,n,s),0==_.getState()&&(c[_.getKey()]=!0,u.isKeyQueued(_.getKey())||u.enqueue([_,h,i.getTileCoordCenter(_.tileCoord),m])),void 0!==l&&l(_)):e.useTile(x,y,v,s));e.updateCacheSize(w,s)}},Kr=class extends Ir{constructor(t){super(t)}createRenderer(){return new Zr(this)}},Vr=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return ot(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return ot(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){ot(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}};function Ur(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Hr(t,e,i){return t+"/"+e+"/"+i}function qr(t){return Hr(t[0],t[1],t[2])}const Jr=class extends Vr{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey().split("/").map(Number)[0];this.forEach(e=>{e.tileCoord[0]!==t&&(this.remove(qr(e.tileCoord)),e.release())})}};function $r(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}const Qr=class extends K{constructor(t){super(),this.projection=ci(t.projection),this.attributions_=$r(t.attributions),this.attributionsCollapsible_=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=$r(t),this.changed()}setState(t){this.state_=t,this.changed()}},to=[0,0,0],eo=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,ot(function(t){const e=((t,e)=>e-t)||y;return t.every(function(i,n){if(0===n)return!0;const s=e(t[n-1],i);return!(s>0||0===s)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,ot(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=zt(i)),ot(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,ot(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,ot(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const n=new Br(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),s=Yr(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,l,i),e(l,s))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return Yr(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return Yr(s,r,s,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(s*t),a=Math.floor(r*t);return e<n?Yr(o,o,a,a,i):Yr(o,Math.floor(t*(s+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,to);const n=to[1],s=to[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,to),Yr(n,to[1],s,to[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=Cr(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=Cr(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n;return xt(r,o,r+s[0]*n,o+s[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),l=Cr(this.getTileSize(r),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=he(h,5)-1,c=he(c,5)-1):(h=le(h,5),c=le(c,5)),Ur(r,h,c,s)}getTileCoordForXYAndZ_(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),a=Cr(this.getTileSize(i),this.tmpSize_);let l=(t-r[0])/o/a[0],h=(r[1]-e)/o/a[1];return n?(l=he(l,5)-1,h=he(h,5)-1):(l=le(l,5),h=le(h,5)),Ur(i,l,h,s)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return ee(v(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return En(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function io(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const s=no(t,e,i);return new eo({extent:t,origin:Ot(t,n),resolutions:s,tileSize:i})}(so(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function no(t,e,i,n){e=void 0!==e?e:42,i=Cr(void 0!==i?i:256);const s=Gt(t),r=Wt(t);n=n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function so(t){let e=(t=ci(t)).getExtent();if(!e){const i=180*De.degrees/t.getMetersPerUnit();e=xt(-i,-i,i,i)}return e}class ro extends _{constructor(t,e){super(t),this.tile=e}}const oo=class extends Qr{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;this.tileGrid&&Cr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tileCache=new Jr(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const s=this.getTileCacheForProjection(t);if(!s)return!1;let r,o,a,l=!0;for(let t=i.minX;t<=i.maxX;++t)for(let h=i.minY;h<=i.maxY;++h)o=Hr(e,t,h),a=!1,s.containsKey(o)&&(r=s.get(o),a=2===r.getState(),a&&(a=!1!==n(r))),a||(l=!1);return l}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,s){return X()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:io(t)}getTileCacheForProjection(t){const e=this.getProjection();return ot(null===e||_i(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=Cr(n.getTileSize(t),this.tmpSize);return 1==s?r:(o=r,a=s,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=function(t,e,i){const n=e[0],s=t.getTileCoordCenter(e),r=so(i);if(!pt(r,s)){const e=Wt(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}return e}(i,t,e)),function(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}};function ao(t,e){const i=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,function(){const t=o[0],i=e.getFullTileRange(t);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()})}}class lo extends oo{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===lo.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=B(e),n=e.getState();let s;1==n?(this.tileLoadingKeys_[i]=!0,s="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=s&&this.dispatchEvent(new ro(s,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ao(t[s],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const s=function(t){return(t[1]<<t[0])+t[2]}(e),r=re(s,t.length);return t[r](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=Hr(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const ho=lo;function co(t,e){t.getImage().src=e}const uo=class extends ho{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:co,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:Or,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!_i(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!_i(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||_i(e,t)))return this.tileGrid;const i=B(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=io(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||_i(e,t))return this.tileCache;const i=B(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Jr(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,n,s,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,s),l=a?this.tileUrlFunction(a,n,s):void 0,h=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=r,h.addEventListener(P,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,s){const r=this.getProjection();if(!r||!s||_i(r,s))return this.getTileInternal(t,e,i,n,r||s);const o=this.getTileCacheForProjection(s),a=[t,e,i];let l;const h=qr(a);o.containsKey(h)&&(l=o.get(h));const c=this.getKey();if(l&&l.key==c)return l;const u=this.getTileGridForProjection(r),d=this.getTileGridForProjection(s),g=this.getTileCoordForTileUrlFunction(a,s),f=new Wr(r,u,s,d,a,g,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=c,l?(f.interimTile=l,f.refreshInterimChain(),o.replace(h,f)):o.set(h,f),f}getTileInternal(t,e,i,n,s){let r=null;const o=Hr(t,e,i),a=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=a){const l=r;r=this.createTile_(t,e,i,n,s,a),0==l.getState()?r.interimTile=l.interimTile:r.interimTile=l,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.createTile_(t,e,i,n,s,a),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=ci(t);if(i){const t=B(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}},go=class extends uo{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||ci("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:no(i,e.maxZoom,e.tileSize,e.maxResolution)};return new eo(n)}({extent:so(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}};class fo extends K{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new fo(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(z(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=G(t,P,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(ot("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}const _o=fo;function po(t,e,i,n,s,r,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=s;else if(0!==h){let r=t[e],o=t[e+1],h=0;const c=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];h+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(h),r=e,o=i}const u=s*h,d=function(t,e,i){let n,s;i=i||y;let r=0,o=t.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}(c,u);d<0?(l=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===l?t[a+e]:oe(t[a+e],t[a+n+e],l);return r}function mo(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;s<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(s==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(s-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(oe(t[(a-1)*n+e],t[a*n+e],c));return o.push(s),o}function yo(t,e,i,n){const s=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=St(t,e,a[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return s}const vo=[1,0,0,1,0,0];class xo{constructor(t,e,i,n,s,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=s,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Ct(this.flatCoordinates_):St(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=kt(this.getExtent());this.flatInteriorPoints_=xn(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=function(t,e){const i=[];let n,s=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=Rn(t,s,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,s=a}return i}(this.flatCoordinates_,this.ends_),e=yo(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=wn(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=po(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,s=i.length;n<s;++n){const s=i[n],r=po(t,e,s,2,.5);w(this.flatMidpoints_,r),e=s}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=ci(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Gt(i)/Gt(e);lt(vo,i[0],i[3],t,-t,0,0,0),Wi(this.flatCoordinates_,0,this.flatCoordinates_.length,2,vo,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new xo(this.type_,this.flatCoordinates_.slice(),this.ends_.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=T((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=nn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=sn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=an(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new xo(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}xo.prototype.getFlatCoordinates=xo.prototype.getOrientedFlatCoordinates;const wo=xo;function Co(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}class So extends Vi{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){w(this.flatCoordinates,t),this.changed()}clone(){const t=new So(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<_t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ji(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,mo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return ln(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return po(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Co(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=nn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new So(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Sn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qi(this.flatCoordinates,0,t,this.stride),this.changed()}}const Eo=So;class bo extends Vi{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){w(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new bo(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<_t(this.getExtent(),t,e))return n;const s=this.flatCoordinates,r=this.stride;for(let o=0,a=s.length;o<a;o+=r){const a=ne(t,e,s[o],s[o+1]);if(a<n){n=a;for(let t=0;t<r;++t)i[t]=s[o+t];i.length=r}}return n}getCoordinates(){return ln(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new pn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let s=0,r=t.length;s<r;s+=i){const r=new pn(t.slice(s,s+i),e);n.push(r)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,s=e.length;n<s;n+=i)if(yt(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qi(this.flatCoordinates,0,t,this.stride),this.changed()}}const To=bo;class Ro extends Vi{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,s=e.length;t<s;++t)w(i,e[t].getFlatCoordinates()),n.push(i.length);const s=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(s,i),this.ends_=n}}appendLineString(t){w(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ro(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<_t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qi(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$i(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,s,r,o){if(o)return mo(t,e,i[i.length-1],n,s,r);let a;if(s<t[n-1])return r?(a=t.slice(0,n),a[n-1]=s,a):null;if(t[t.length-1]<s)return r?(a=t.slice(t.length-n),a[n-1]=s,a):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(s<t[e+n-1])return null;if(s<=t[o-1])return mo(t,e,o,n,s,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return hn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Eo(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new Eo(t.slice(s,o),i);n.push(a),s=o}return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,s=this.stride;for(let r=0,o=n.length;r<o;++r){const o=n[r];w(t,po(e,i,o,s,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=sn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Ro(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){if(Sn(t,e,i[r],n,s))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=tn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Io=Ro;class Mo extends Vi{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,s=[],r=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=s.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;w(s,e.getFlatCoordinates()),r.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=s,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;w(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Mo(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<_t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=qi(t,e,o,n,s),e=o[o.length-1]}return s}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let r=0,u=i.length;r<u;++r){const u=i[r];h=$i(t,e,u,n,s,true,o,a,l,h,c),e=u[u.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,s,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(vn(t,e,a,n,s,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=dn(t,e,o,n),e=o[o.length-1]}return s}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Ln(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,cn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=yo(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=wn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new To(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Mn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ln(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=an(t,e,h,n,s,r,o,c),a.push(c),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Mo(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new kn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==s)for(let t=0,e=o.length;t<e;++t)o[t]-=s;const l=new kn(e.slice(s,a),t,o);n.push(l),s=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(bn(t,e,o,n,s))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=en(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Po=Mo;class Lo extends Bi{constructor(t){super(),this.geometries_=t||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(z),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(this.geometries_)for(let t=0,e=this.geometries_.length;t<e;++t)this.changeEventsKeys_.push(G(this.geometries_[t],P,this.changed,this))}clone(){const t=new Lo(null);return t.setGeometries(this.geometries_),t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<_t(this.getExtent(),t,e))return n;const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)n=s[r].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){wt(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)bt(t,e[i].getExtent());return t}getGeometries(){return Fo(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let s=0,r=i.length;s<r;++s){const r=i[s],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(n=!0)}if(n){const t=new Lo(null);return t.setGeometriesArray(e),t}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=kt(this.getExtent()));const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Fo(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Fo(t){const e=[];for(let i=0,n=t.length;i<n;++i)e.push(t[i].clone());return e}const ko=Lo,Oo=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=_o,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?ci(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=ci(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return X()}readFeature(t,e){return X()}readFeatures(t,e){return X()}readGeometry(t,e){return X()}readProjection(t){return X()}writeFeature(t,e){return X()}writeFeatures(t,e){return X()}writeGeometry(t,e){return X()}};function Ao(t,e,i){const n=i?ci(i.featureProjection):null,s=i?ci(i.dataProjection):null;let r=t;if(n&&s&&!_i(n,s)){e&&(r=t.clone());const i=e?n:s,o=e?s:n;"tile-pixels"===i.getUnits()?r.transform(i,o):r.applyTransform(mi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};r===t&&(r=t.clone()),r.applyTransform(n)}return r}const Do={Point:pn,LineString:Eo,Polygon:kn,MultiPoint:To,MultiLineString:Io,MultiPolygon:Po};function Go(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>Go({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const s=i.layout.length;return Ao(new wo(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(Mn(t,0,e,i)||Ln(t=t.slice(),0,e,i),t):(In(t,0,e,i)||Pn(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat(),s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function jo(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>jo(t,e));return new ko(i)}return Ao(new(0,Do[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}function zo(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const No=class extends Oo{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(zo(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(zo(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return X()}readFeaturesFromObject(t,e){return X()}readGeometry(t,e){return this.readGeometryFromObject(zo(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return X()}readProjection(t){return this.readProjectionFromObject(zo(t))}readProjectionFromObject(t){return X()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return X()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return X()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return X()}};function Wo(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Zi(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:Zi(e[0].length)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0][0].length;return{type:"Polygon",flatCoordinates:i,ends:tn(i,0,e,n),layout:Zi(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Zi(e[0].length)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0][0].length,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:tn(n,0,e,i),layout:Zi(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0][0][0].length;return{type:"MultiPolygon",flatCoordinates:i,ends:en(i,0,e,n),layout:Zi(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Wo(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Xo(t,e){const i=(t=Ao(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return Xo(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const Yo=class extends No{constructor(t){t=t||{},super(),this.dataProjection=ci(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=ci(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=Wo(i.geometry);if(this.featureClass===wo)return Go({geometry:n,id:i.id,properties:i.properties},e);const s=new _o;return this.geometryName_?s.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&s.setGeometryName(i.geometry_name),s.setGeometry(jo(n,e)),"id"in i&&s.setId(i.id),i.properties&&s.setProperties(i.properties,!0),s}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,s=n.length;t<s;++t){const s=this.readFeatureFromObject(n[t],e);s&&i.push(s)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return jo(Wo(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=ci(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=ci("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const s=t.getProperties(),r=t.getGeometry();return r&&(i.geometry=Xo(r,e),delete s[t.getGeometryName()]),I(s)||(i.properties=s),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,s=t.length;n<s;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Xo(t,this.adaptOptions(e))}};var Bo=s(260);class Zo{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Cr(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Zo({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return X()}getImage(t){return X()}getHitDetectionImage(){return X()}getPixelRatio(t){return 1}getImageState(){return X()}getImageSize(){return X()}getOrigin(){return X()}getSize(){return X()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Cr(t)}listenImageChange(t){X()}load(){X()}unlistenImageChange(t){X()}}const Ko=Zo;function Vo(t){return Array.isArray(t)?ye(t):t}class Uo extends Ko{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=void 0!==t.radius?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.render()}clone(){const t=this.getScale(),e=new Uo({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=Jn(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return 2}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),_=s-Math.sqrt(n*n-f*f),p=Math.sqrt(f*f+_*_)/f;if(p<=i){const t=p*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=ns,i=rs,n=0,s=null,r=0,o=0;this.stroke_&&(t=Vo(this.stroke_.getColor()??os),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??rs,e=this.stroke_.getLineCap()??ns,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius_,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvases_={},this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=is),e.fillStyle=Vo(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=pe(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=Jn(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius_;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=is,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}}const Ho=Uo;class qo extends Ho{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new qo({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}const Jo=qo;class $o{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null}clone(){const t=this.getColor();return new $o({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}const Qo=$o;class ta{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new ta({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const ea=ta;class ia{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ra,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new ia({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=ra,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let na=null;function sa(t,e){if(!na){const t=new Qo({color:"rgba(255,255,255,0.4)"}),e=new ea({color:"#3399CC",width:1.25});na=[new ia({image:new Jo({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return na}function ra(t){return t.getGeometry()}const oa=ia;let aa=null;class la extends M{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?0:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){aa||(aa=Jn(1,1,void 0,{willReadFrequently:!0})),aa.drawImage(this.image_,0,0);try{aa.getImageData(0,0,1,1),this.tainted_=!1}catch(t){aa=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(P)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=Jn(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&st?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){r(),e(t)}function s(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",n),t.removeEventListener("error",s)}t.addEventListener("load",n),t.addEventListener("error",s)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=ce(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}}function ha(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ca extends Ko{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(ot(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||B(r)),ot(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),ot(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==r&&(o=r instanceof HTMLImageElement?r.complete?r.src?2:0:1:2),this.color_=void 0!==t.color?pe(t.color):null,this.iconImage_=function(t,e,i,n,s){let r=void 0===e?void 0:xe.get(e,i,s);return r||(r=new la(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,s),xe.set(e,i,s,r)),r}(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(ha(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ha(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ca({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(P,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(P,t)}}const ua=ca;class da{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=Cr(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new Qo({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new da({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Cr(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const ga=da;let fa=0;const _a=1<<fa++,pa=1<<fa++,ma=1<<fa++,ya=1<<fa++,va=1<<fa++,xa=Math.pow(2,5)-1,wa={[_a]:"boolean",[pa]:"number",[ma]:"string",[ya]:"color",[va]:"number[]"},Ca=Object.keys(wa).map(Number).sort(y);function Sa(t){const e=[];for(const i of Ca)Ea(t,i)&&e.push(wa[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Ea(t,e){return(t&e)===e}function ba(t,e){return!!(t&e)}function Ta(t,e){return t===e}class Ra{constructor(t,e){this.type=t,this.value=e}}class Ia{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Ma(){return{variables:new Set,properties:new Set,featureId:!1,style:{}}}function Pa(t,e,i){switch(typeof t){case"boolean":return new Ra(_a,t);case"number":return new Ra(pa,t);case"string":{let e=ma;return function(t){try{return _e(t),!0}catch(t){return!1}}(t)&&(e|=ya),Ta(e&i,0)||(e&=i),new Ra(e,t)}}if(!Array.isArray(t))throw new Error("Expression must be an array or a primitive value");if(0===t.length)throw new Error("Empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=xl[n];if(!s)throw new Error(`Unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("Expected an array of numbers");let n=va;return 3!==t.length&&4!==t.length||(n|=ya),i&&(n&=i),new Ra(n,t)}const La="get",Fa="var",ka="concat",Oa="geometry-type",Aa="any",Da="all",Ga="!",ja="resolution",za="zoom",Na="time",Wa="==",Xa="!=",Ya=">",Ba=">=",Za="<",Ka="<=",Va="*",Ua="/",Ha="+",qa="-",Ja="clamp",$a="%",Qa="^",tl="abs",el="floor",il="ceil",nl="round",sl="sin",rl="cos",ol="atan",al="sqrt",ll="match",hl="between",cl="interpolate",ul="case",dl="in",gl="number",fl="string",_l="array",pl="color",ml="id",yl="band",vl="palette",xl={[La]:Tl(([t,e])=>void 0!==e?function(t){switch(t){case"string":return ma;case"color":return ya;case"number":return pa;case"boolean":return _a;case"number[]":return va;default:throw new Error(`Unrecognized type hint: ${t}`)}}(e.value):xa,Cl(1,2),function(t,e){const i=Pa(t[1],e);if(!(i instanceof Ra))throw new Error("Expected a literal argument for get operation");if("string"!=typeof i.value)throw new Error("Expected a string argument for get operation");return e.properties.add(i.value),3===t.length?[i,Pa(t[2],e)]:[i]}),[Fa]:Tl(([t])=>t.type,Cl(1,1),function(t,e,i,n){const s=t[1];if("string"!=typeof s)throw new Error("Expected a string argument for var operation");if(e.variables.add(s),!("variables"in e.style)||void 0===e.style.variables[s])return[new Ra(xa,s)];const r=Pa(e.style.variables[s],e);if(r.value=s,n&&!ba(n,r.type))throw new Error(`The variable ${s} has type ${Sa(r.type)} but the following type was expected: ${Sa(n)}`);return[r]}),[ml]:Tl(pa|ma,wl,function(t,e){e.featureId=!0}),[ka]:Tl(ma,Cl(2,1/0),Sl(xa)),[Oa]:Tl(ma,wl),[ja]:Tl(pa,wl),[za]:Tl(pa,wl),[Na]:Tl(pa,wl),[Aa]:Tl(_a,Cl(2,1/0),Sl(_a)),[Da]:Tl(_a,Cl(2,1/0),Sl(_a)),[Ga]:Tl(_a,Cl(1,1),Sl(_a)),[Wa]:Tl(_a,Cl(2,2),Sl(xa),El),[Xa]:Tl(_a,Cl(2,2),Sl(xa),El),[Ya]:Tl(_a,Cl(2,2),Sl(xa),El),[Ba]:Tl(_a,Cl(2,2),Sl(xa),El),[Za]:Tl(_a,Cl(2,2),Sl(xa),El),[Ka]:Tl(_a,Cl(2,2),Sl(xa),El),[Va]:Tl(t=>{let e=pa|ya;for(let i=0;i<t.length;i++)e&=t[i].type;return e},Cl(2,1/0),Sl(pa|ya),El),[Ua]:Tl(pa,Cl(2,2),Sl(pa)),[Ha]:Tl(pa,Cl(2,1/0),Sl(pa)),[qa]:Tl(pa,Cl(2,2),Sl(pa)),[Ja]:Tl(pa,Cl(3,3),Sl(pa)),[$a]:Tl(pa,Cl(2,2),Sl(pa)),[Qa]:Tl(pa,Cl(2,2),Sl(pa)),[tl]:Tl(pa,Cl(1,1),Sl(pa)),[el]:Tl(pa,Cl(1,1),Sl(pa)),[il]:Tl(pa,Cl(1,1),Sl(pa)),[nl]:Tl(pa,Cl(1,1),Sl(pa)),[sl]:Tl(pa,Cl(1,1),Sl(pa)),[rl]:Tl(pa,Cl(1,1),Sl(pa)),[ol]:Tl(pa,Cl(1,2),Sl(pa)),[al]:Tl(pa,Cl(1,1),Sl(pa)),[ll]:Tl(t=>{let e=xa;for(let i=2;i<t.length;i+=2)e&=t[i].type;return e&=t[t.length-1].type,e},Cl(4,1/0),bl,function(t,e,i,n){const s=t.length-1;let r=Pa(t[1],e).type;const o=Pa(t[t.length-1],e);let a=void 0!==n?n&o.type:o.type;const l=new Array(s-2);for(let i=0;i<s-2;i+=2){const n=Pa(t[i+2],e),s=Pa(t[i+3],e);r&=n.type,a&=s.type,l[i]=n,l[i+1]=s}const h=ma|pa|_a;if(!ba(h,r))throw new Error(`Expected an input of type ${Sa(h)} for the interpolate operation, got ${Sa(r)} instead`);if(Ta(a,0))throw new Error("Could not find a common output type for the following match operation: "+JSON.stringify(t));for(let i=0;i<s-2;i+=2){const n=Pa(t[i+2],e,r),s=Pa(t[i+3],e,a);l[i]=n,l[i+1]=s}return[Pa(t[1],e,r),...l,Pa(t[t.length-1],e,a)]}),[hl]:Tl(_a,Cl(3,3),Sl(pa)),[cl]:Tl(t=>{let e=ya|pa;for(let i=3;i<t.length;i+=2)e&=t[i].type;return e},Cl(6,1/0),bl,function(t,e,i,n){const s=t[1];let r;switch(s[0]){case"linear":r=1;break;case"exponential":if(r=s[1],"number"!=typeof r)throw new Error(`Expected a number base for exponential interpolation, got ${JSON.stringify(r)} instead`);break;default:r=null}if(!r)throw new Error(`Invalid interpolation type: ${JSON.stringify(s)}`);r=Pa(r,e);let o=Pa(t[2],e);if(!ba(pa,o.type))throw new Error(`Expected an input of type number for the interpolate operation, got ${Sa(o.type)} instead`);o=Pa(t[2],e,pa);const a=new Array(t.length-3);for(let i=0;i<a.length;i+=2){let n=Pa(t[i+3],e);if(!ba(pa,n.type))throw new Error(`Expected all stop input values in the interpolate operation to be of type number, got ${Sa(n.type)} at position ${i+2} instead`);let s=Pa(t[i+4],e);if(!ba(pa|ya,s.type))throw new Error(`Expected all stop output values in the interpolate operation to be a number or color, got ${Sa(s.type)} at position ${i+3} instead`);n=Pa(t[i+3],e,pa),s=Pa(t[i+4],e,pa|ya),a[i]=n,a[i+1]=s}return[r,o,...a]}),[ul]:Tl(t=>{let e=xa;for(let i=1;i<t.length;i+=2)e&=t[i].type;return e&=t[t.length-1].type,e},Cl(3,1/0),function(t,e){const i=t[0],n=t.length-1;if(n%2==0)throw new Error(`An odd amount of arguments was expected for operation ${i}, got ${JSON.stringify(n)} instead`)},function(t,e,i,n){const s=Pa(t[t.length-1],e);let r=void 0!==n?n&s.type:s.type;const o=new Array(t.length-1);for(let i=0;i<o.length-1;i+=2){const n=Pa(t[i+1],e),s=Pa(t[i+2],e);if(!ba(_a,n.type))throw new Error(`Expected all conditions in the case operation to be of type boolean, got ${Sa(n.type)} at position ${i} instead`);r&=s.type,o[i]=n,o[i+1]=s}if(Ta(r,0))throw new Error("Could not find a common output type for the following case operation: "+JSON.stringify(t));for(let i=0;i<o.length-1;i+=2)o[i+1]=Pa(t[i+2],e,r);return o[o.length-1]=Pa(t[t.length-1],e,r),o}),[dl]:Tl(_a,Cl(2,2),function(t,e){let i=t[2];if(!Array.isArray(i))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');if("string"==typeof i[0]){if("literal"!==i[0])throw new Error('For the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions.');if(!Array.isArray(i[1]))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');i=i[1]}let n=ma|pa;const s=new Array(i.length);for(let t=0;t<s.length;t++){const r=Pa(i[t],e);n&=r.type,s[t]=r}if(Ta(n,0))throw new Error("Could not find a common type for the following in operation: "+JSON.stringify(t));return[Pa(t[1],e,n),...s]}),[gl]:Tl(pa,Cl(1,1/0),Sl(xa)),[fl]:Tl(ma,Cl(1,1/0),Sl(xa)),[_l]:Tl(t=>3===t.length||4===t.length?va|ya:va,Cl(1,1/0),Sl(pa)),[pl]:Tl(ya,Cl(3,4),Sl(pa)),[yl]:Tl(pa,Cl(1,3),Sl(pa)),[vl]:Tl(ya,Cl(2,2),function(t,e){const i=Pa(t[1],e,pa);if(i.type!==pa)throw new Error(`The first argument of palette must be an number, got ${Sa(i.type)} instead`);const n=t[2];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const s=new Array(n.length);for(let t=0;t<s.length;t++){const i=Pa(n[t],e,ya);if(!(i instanceof Ra))throw new Error(`The palette color at index ${t} must be a literal value`);if(!ba(i.type,ya))throw new Error(`The palette color at index ${t} should be of type color, got ${Sa(i.type)} instead`);s[t]=i}return[i,...s]})};function wl(t,e){const i=t[0];if(1!==t.length)throw new Error(`Expected no arguments for ${i} operation`);return[]}function Cl(t,e){return function(i,n){const s=i[0],r=i.length-1;if(t===e){if(r!==t)throw new Error(`Expected ${t} argument${1===t?"":"s"} for ${s}, got ${r}`)}else if(r<t||r>e)throw new Error(`Expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${r}`)}}function Sl(t){return function(e,i){const n=e[0],s=e.length-1,r=new Array(s);for(let o=0;o<s;++o){const s=Pa(e[o+1],i);if(!ba(t,s.type)){const e=Sa(t),i=Sa(s.type);throw new Error(`Unexpected type for argument ${o} of ${n} operation, got ${e} but expected ${i}`)}s.type&=t,r[o]=s}return r}}function El(t,e,i){const n=t[0],s=t.length-1;let r=xa;for(let t=0;t<i.length;++t)r&=i[t].type;if(0===r)throw new Error(`No common type could be found for arguments of ${n} operation`);const o=new Array(s);for(let i=0;i<s;++i)o[i]=Pa(t[i+1],e,r);return o}function bl(t,e){const i=t[0],n=t.length-1;if(n%2==1)throw new Error(`An even amount of arguments was expected for operation ${i}, got ${JSON.stringify(n)} instead`)}function Tl(t,...e){return function(i,n,s){const r=i[0];let o=[];for(let t=0;t<e.length;t++)o=e[t](i,n,o,s)||o;let a="function"==typeof t?t(o):t;if(void 0!==s){if(!ba(a,s))throw new Error(`The following expression was expected to return ${Sa(s)}, but returns ${Sa(a)} instead: ${JSON.stringify(i)}`);a&=s}if(0===a)throw new Error(`No matching type was found for the following expression: ${JSON.stringify(i)}`);return new Ia(a,r,...o)}}function Rl(t,e,i){const n=Pa(t,i);if(!ba(e,n.type)){const t=Sa(e),i=Sa(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return Il(n,i)}function Il(t,e){if(t instanceof Ra){if(t.type===ya&&"string"==typeof t.value){const e=_e(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case gl:case fl:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=Il(t.args[i],e);switch(i){case gl:case fl:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case La:case Fa:return function(t){const e=t.args[0].value;switch(t.operator){case La:return t=>t.properties[e];case Fa:return t=>t.variables[e];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case ka:{const i=t.args.map(t=>Il(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case ja:return t=>t.resolution;case Aa:case Da:case"!":return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=Il(t.args[i],e);switch(i){case Aa:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case Da:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case"!":return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case Wa:case Xa:case"<":case Ka:case">":case Ba:return function(t,e){const i=t.operator,n=Il(t.args[0],e),s=Il(t.args[1],e);switch(i){case Wa:return t=>n(t)===s(t);case Xa:return t=>n(t)!==s(t);case"<":return t=>n(t)<s(t);case Ka:return t=>n(t)<=s(t);case">":return t=>n(t)>s(t);case Ba:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Ja:case"%":case"^":case tl:case el:case il:case nl:case sl:case rl:case ol:case al:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=Il(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case"/":return t=>s[0](t)/s[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case"-":return t=>s[0](t)-s[1](t);case Ja:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case"%":return t=>s[0](t)%s[1](t);case"^":return t=>Math.pow(s[0](t),s[1](t));case tl:return t=>Math.abs(s[0](t));case el:return t=>Math.floor(s[0](t));case il:return t=>Math.ceil(s[0](t));case nl:return t=>Math.round(s[0](t));case sl:return t=>Math.sin(s[0](t));case rl:return t=>Math.cos(s[0](t));case ol:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case al:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case ll:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Il(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}(t,e);case cl:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Il(t.args[s],e);return t=>{const e=n[0](t),s=n[1](t);let r,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=ge(l)),i>=s)return 2===a?l:h?Pl(e,s,r,o,i,l):Ml(e,s,r,o,i,l);r=i,o=l}return o}}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Ml(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function Pl(t,e,i,n,s,r){if(0===s-i)return n;const o=fe(n),a=fe(r);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),me(function(t){const e=Vt.rgb(qt.xyz(t));return e[3]=t[3],e}([Ml(t,e,i,o[0],s,a[0]),Ml(t,e,i,o[1],s,a[1]),o[2]+Ml(t,e,i,0,s,l),Ml(t,e,i,n[3],s,r[3])]))}function Ll(t){return!0}function Fl(t){const e=Ma(),i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=kl(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal(),s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function kl(t,e){const i=Ol(t,"",e),n=Al(t,"",e),s=function(t,e){const i="text-",n=Gl(t,i+"value",e);if(!n)return null;const s=Ol(t,i,e),r=Ol(t,i+"background-",e),o=Al(t,i,e),a=Al(t,i+"background-",e),l=Gl(t,i+"font",e),h=Dl(t,i+"max-angle",e),c=Dl(t,i+"offset-x",e),u=Dl(t,i+"offset-y",e),d=jl(t,i+"overflow",e),g=Gl(t,i+"placement",e),f=Dl(t,i+"repeat",e),_=Xl(t,i+"scale",e),p=jl(t,i+"rotate-with-view",e),m=Dl(t,i+"rotation",e),y=Gl(t,i+"align",e),v=Gl(t,i+"justify",e),x=Gl(t,i+"baseline",e),w=Nl(t,i+"padding",e),C=new ga({});return function(t){if(C.setText(n(t)),s&&C.setFill(s(t)),r&&C.setBackgroundFill(r(t)),o&&C.setStroke(o(t)),a&&C.setBackgroundStroke(a(t)),l&&C.setFont(l(t)),h&&C.setMaxAngle(h(t)),c&&C.setOffsetX(c(t)),u&&C.setOffsetY(u(t)),d&&C.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");C.setPlacement(e)}if(f&&C.setRepeat(f(t)),_&&C.setScale(_(t)),p&&C.setRotateWithView(p(t)),m&&C.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");C.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(e)}return w&&C.setPadding(w(t)),C}}(t,e),r=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",s=Ul(t[n],n),r=Wl(t,i+"anchor",e),o=Xl(t,i+"scale",e),a=Dl(t,i+"opacity",e),l=Wl(t,i+"displacement",e),h=Dl(t,i+"rotation",e),c=jl(t,i+"rotate-with-view",e),u=Bl(t,i+"anchor-origin"),d=Zl(t,i+"anchor-x-units"),g=Zl(t,i+"anchor-y-units"),f=function(t,e){const i=t[e];if(void 0!==i)return ql(i,e)}(t,i+"color"),_=function(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}}(t,i+"cross-origin"),p=function(t,e){const i=t[e];if(void 0!==i)return Vl(i,e)}(t,i+"offset"),m=Bl(t,i+"offset-origin"),y=Yl(t,i+"width"),v=Yl(t,i+"height"),x=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return Cr(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}(t,i+"size"),w=Kl(t,i+"declutter"),C=new ua({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:f,crossOrigin:_,offset:p,offsetOrigin:m,height:v,width:y,size:x,declutterMode:w});return function(t){return a&&C.setOpacity(a(t)),l&&C.setDisplacement(l(t)),h&&C.setRotation(h(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),r&&C.setAnchor(r(t)),C}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",s=Hl(t[n],n),r=Ol(t,i,e),o=Al(t,i,e),a=Xl(t,i+"scale",e),l=Wl(t,i+"displacement",e),h=Dl(t,i+"rotation",e),c=jl(t,i+"rotate-with-view",e),u=Yl(t,i+"radius"),d=Yl(t,i+"radius1"),g=Yl(t,i+"radius2"),f=Yl(t,i+"angle"),_=Kl(t,i+"declutter-mode"),p=new Ho({points:s,radius:u,radius1:d,radius2:g,angle:f,declutterMode:_});return function(t){return r&&p.setFill(r(t)),o&&p.setStroke(o(t)),l&&p.setDisplacement(l(t)),h&&p.setRotation(h(t)),c&&p.setRotateWithView(c(t)),a&&p.setScale(a(t)),p}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=Ol(t,i,e),s=Al(t,i,e),r=Dl(t,i+"radius",e),o=Xl(t,i+"scale",e),a=Wl(t,i+"displacement",e),l=Dl(t,i+"rotation",e),h=jl(t,i+"rotate-with-view",e),c=Kl(t,i+"declutter-mode"),u=new Jo({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e):null}(t,e),o=Dl(t,"z-index",e);if(!(i||n||s||r||I(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new oa;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ol(t,e,i){const n=zl(t,e+"fill-color",i);if(!n)return null;const s=new Qo;return function(t){const e=n(t);return"none"===e?null:(s.setColor(e),s)}}function Al(t,e,i){const n=Dl(t,e+"stroke-width",i),s=zl(t,e+"stroke-color",i);if(!n&&!s)return null;const r=Gl(t,e+"stroke-line-cap",i),o=Gl(t,e+"stroke-line-join",i),a=Nl(t,e+"stroke-line-dash",i),l=Dl(t,e+"stroke-line-dash-offset",i),h=Dl(t,e+"stroke-miter-limit",i),c=new ea;return function(t){if(s){const e=s(t);if("none"===e)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),c}}function Dl(t,e,i){if(!(e in t))return;const n=Rl(t[e],pa,i);return function(t){return Hl(n(t),e)}}function Gl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],ma,i);return function(t){return Ul(n(t),e)}}function jl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],_a,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function zl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],ya|ma,i);return function(t){return ql(n(t),e)}}function Nl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],va,i);return function(t){return Vl(n(t),e)}}function Wl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],va,i);return function(t){const i=Vl(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Xl(t,e,i){if(!(e in t))return null;const n=Rl(t[e],va|pa,i);return function(t){return function(t,e){if("number"==typeof t)return t;const i=Vl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}(n(t),e)}}function Yl(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Bl(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Zl(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Kl(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Vl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Ul(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Hl(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function ql(t,e){if("string"==typeof t)return t;const i=Vl(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}const Jl="renderOrder",$l=class extends Nn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=void 0!==t.declutter&&t.declutter,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Jl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Bo(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(Jl,t)}setStyle(t){this.style_=function(t){if(void 0===t)return sa;if(!t)return null;if("function"==typeof t)return t;if(t instanceof oa)return t;if(!Array.isArray(t))return Fl([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof oa){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof oa))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return function(t){const e=Ma(),i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?Rl(i.filter,_a,e):Ll;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=kl(i.style[n],e)}else o=[kl(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}return s}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null};return function(t,s){if(n.properties=t.getPropertiesInternal(),n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return i(n)}}(i)}return Fl(t)}(t),this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(ot("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(this.style_),this.changed()}},Ql={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},th=[Ql.FILL],eh=[Ql.STROKE],ih=[Ql.BEGIN_PATH],nh=[Ql.CLOSE_PATH],sh=Ql,rh=class{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},oh=class extends rh{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],pt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,_=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=vt(l,u),f!==g?(_&&(o[a++]=h,o[a++]=c,_=!1),o[a++]=u[0],o[a++]=u[1]):1===f?(o[a++]=u[0],o[a++]=u[1],_=!1):_=!0,h=u[0],c=u[1],g=f;return(s&&_||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const s=t.getType(),r=t.getStride(),o=this.coordinates.length;let a,l,h,c,u;switch(s){case"MultiPolygon":a=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();u=0;for(let t=0,i=e.length;t<i;++t){const i=[];u=this.drawCustomCoordinates_(a,u,e[t],r,i),c.push(i)}this.instructions.push([sh.CUSTOM,o,c,t,i,cn]),this.hitDetectionInstructions.push([sh.CUSTOM,o,c,t,n||i,cn]);break;case"Polygon":case"MultiLineString":h=[],a="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),u=this.drawCustomCoordinates_(a,0,t.getEnds(),r,h),this.instructions.push([sh.CUSTOM,o,h,t,i,hn]),this.hitDetectionInstructions.push([sh.CUSTOM,o,h,t,n||i,hn]);break;case"LineString":case"Circle":a=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(a,0,a.length,r,!1,!1),this.instructions.push([sh.CUSTOM,o,l,t,i,ln]),this.hitDetectionInstructions.push([sh.CUSTOM,o,l,t,n||i,ln]);break;case"MultiPoint":a=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(a,r),l>o&&(this.instructions.push([sh.CUSTOM,o,l,t,i,ln]),this.hitDetectionInstructions.push([sh.CUSTOM,o,l,t,n||i,ln]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),l=this.coordinates.length,this.instructions.push([sh.CUSTOM,o,l,t,i]),this.hitDetectionInstructions.push([sh.CUSTOM,o,l,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[sh.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[sh.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==sh.END_GEOMETRY?r=e:s==sh.BEGIN_GEOMETRY&&(n[2]=e,x(this.hitDetectionInstructions,r,e),r=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const e=t.getColor();i.fillStyle=Vo(e||is)}else i.fillStyle=void 0;if(e){const t=e.getColor();i.strokeStyle=Vo(t||os);const n=e.getLineCap();i.lineCap=void 0!==n?n:ns;const s=e.getLineDash();i.lineDash=s?s.slice():ss;const r=e.getLineDashOffset();i.lineDashOffset=r||0;const o=e.getLineJoin();i.lineJoin=void 0!==o?o:rs;const a=e.getWidth();i.lineWidth=void 0!==a?a:1;const l=e.getMiterLimit();i.miterLimit=void 0!==l?l:10,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[sh.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[sh.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!C(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[sh.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ft(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;gt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ah=class extends oh{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ih),this.hitDetectionInstructions.push(ih);for(let s=0;s<a;++s){const r=i[s],a=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),h=[sh.MOVE_TO_LINE_TO,a,l];this.instructions.push(h),this.hitDetectionInstructions.push(h),o&&(this.instructions.push(nh),this.hitDetectionInstructions.push(nh)),e=r}return r&&(this.instructions.push(th),this.hitDetectionInstructions.push(th)),o&&(this.instructions.push(eh),this.hitDetectionInstructions.push(eh)),e}drawCircle(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([sh.SET_FILL_STYLE,is]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ss,0]);const r=t.getFlatCoordinates(),o=t.getStride(),a=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,o,!1,!1);const l=[sh.CIRCLE,a];this.instructions.push(ih,l),this.hitDetectionInstructions.push(ih,l),void 0!==i.fillStyle&&(this.instructions.push(th),this.hitDetectionInstructions.push(th)),void 0!==i.strokeStyle&&(this.instructions.push(eh),this.hitDetectionInstructions.push(eh)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([sh.SET_FILL_STYLE,is]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ss,0]);const r=t.getEnds(),o=t.getOrientedFlatCoordinates(),a=t.getStride();this.drawFlatCoordinatess_(o,0,r,a),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([sh.SET_FILL_STYLE,is]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ss,0]);const r=t.getEndss(),o=t.getOrientedFlatCoordinates(),a=t.getStride();let l=0;for(let t=0,e=r.length;t<e;++t)l=this.drawFlatCoordinatess_(o,l,r[t],a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=rn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}};function lh(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=oe(i,h,e),g=oe(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=oe(i,h,t/u),d=oe(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function hh(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,_=i,p=i,m=0,y=0,v=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,_=v,p=o),y=0,v=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[v,o]:[_,p]}const ch={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},uh={Circle:ah,Default:oh,Image:class extends oh{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([sh.DRAW_IMAGE,s,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([sh.DRAW_IMAGE,s,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([sh.DRAW_IMAGE,s,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([sh.DRAW_IMAGE,s,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends oh{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[sh.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ss,0],ih);const r=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(r,0,r.length,o),this.hitDetectionInstructions.push(eh),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([sh.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ss,0],ih);const r=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride();let l=0;for(let t=0,e=r.length;t<e;++t)l=this.drawFlatCoordinates_(o,l,r[t],a);this.hitDetectionInstructions.push(eh),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(eh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(eh),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ih)}},Polygon:ah,Text:class extends oh{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[is]={fillStyle:is},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const r=this.coordinates;let o=r.length;const a=t.getType();let l=null,h=t.getStride();if("line"!==s.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){let i=s.overflow?null:[];switch(a){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),h=2;break;case"Polygon":l=t.getFlatInteriorPoint(),s.overflow||i.push(l[2]/this.resolution),h=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,n=e.length;t<n;t+=3)s.overflow||i.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;h=2}const n=this.appendFlatPointCoordinates(l,h);if(n===o)return;if(i&&(n-o)/2!==l.length/h){let t=o/2;i=i.filter((e,i)=>{const n=r[2*(t+i)]===l[i*h]&&r[2*(t+i)+1]===l[i*h+1];return n||--t,n})}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let c=s.padding;if(c!=hs&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([sh.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==hs?hs:c.map(function(t){return t*u}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/u,g=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=is,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([sh.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,c,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?is:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=g,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!Xt(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(l=t.getFlatCoordinates(),"LineString"==a)i=[l.length];else if("MultiLineString"==a)i=t.getEnds();else if("Polygon"==a)i=t.getEnds().slice(0,1);else if("MultiPolygon"==a){const e=t.getEndss();i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t][0])}this.beginGeometry(t,e);const n=s.repeat,c=n?void 0:s.textAlign;let u=0;for(let t=0,e=i.length;t<e;++t){let e;e=n?lh(n*this.resolution,l,u,i[t],h):[l.slice(u,i[t])];for(let n=0,a=e.length;n<a;++n){const a=e[n];let l=0,d=a.length;if(null==c){const t=hh(s.maxAngle,a,0,a.length,2);l=t[0],d=t[1]}for(let t=l;t<d;t+=h)r.push(a[t],a[t+1]);const g=r.length;u=i[t],this.drawChars_(o,g),o=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||as,justify:e.justify,textBaseline:e.textBaseline||ls,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=ch[n.textBaseline],h=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([sh.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,s,u*a,c,r,1]),this.hitDetectionInstructions.push([sh.DRAW_CHARS,t,e,l,n.overflow,o?is:o,n.maxAngle,a,h,s,u*a,c,r,1/a])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Vo(e.getColor()||is)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||ns,s.lineDash=t?t.slice():ss,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||rs,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=Vo(r.getColor()||os)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||es;fs(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||ls,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||hs,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textRotation_=void 0===u?0:u,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:B(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?"string"==typeof n.fillStyle?n.fillStyle:"|"+B(n.fillStyle):""}else this.text_="";this.declutterImageWithText_=e}}},dh=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];return void 0===s&&(s=new(0,uh[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s),s}};function gh(t,e,i,n,s,r,o,a,l,h,c,u){let d=t[e],g=t[e+1],f=0,_=0,p=0,m=0;function y(){f=d,_=g,d=t[e+=n],g=t[e+1],m+=p,p=Math.sqrt((d-f)*(d-f)+(g-_)*(g-_))}do{y()}while(e<i-n&&m+p<r);let v=0===p?0:(r-m)/p;const x=oe(f,d,v),w=oe(_,g,v),C=e-n,S=m,E=r+a*l(h,s,c);for(;e<i-n&&m+p<E;)y();v=0===p?0:(E-m)/p;const b=oe(f,d,v),T=oe(_,g,v);let R;if(u){const t=[x,w,b,T];Xi(t,0,4,2,u,t,t),R=t[0]>t[2]}else R=x>b;const I=Math.PI,M=[],P=C+n===e;let L;if(p=0,m=S,d=t[e=C],g=t[e+1],P){y(),L=Math.atan2(g-_,d-f),R&&(L+=L>0?-I:I);const t=(b+x)/2,e=(T+w)/2;return M[0]=[t,e,(E-r)/2,L,s],M}for(let t=0,u=(s=s.replace(/\n/g," ")).length;t<u;){y();let x=Math.atan2(g-_,d-f);if(R&&(x+=x>0?-I:I),void 0!==L){let t=x-L;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}L=x;const w=t;let C=0;for(;t<u;++t){const o=a*l(h,s[R?u-t-1:t],c);if(e+n<i&&m+p<r+C+o/2)break;C+=o}if(t===w)continue;const S=R?s.substring(u-w,u-t):s.substring(w,t);v=0===p?0:(r+C/2-m)/p;const E=oe(f,d,v),b=oe(_,g,v);M.push([E,b,C/2,x,S]),r+=C}return M}const fh=[1/0,1/0,-1/0,-1/0],_h=[],ph=[],mh=[],yh=[];function vh(t){return t[3].declutterBox}const xh=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function wh(t,e){return"start"===e?e=xh.test(t)?"right":"left":"end"===e&&(e=xh.test(t)?"left":"right"),ch[e]}function Ch(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}const Sh=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=Array.isArray(t),u=a.justify?ch[a.justify]:wh(Array.isArray(t)?t[0]:t,a.textAlign||as),d=n&&r.lineWidth?r.lineWidth:0,g=c?t:t.split("\n").reduce(Ch,[]),{width:f,height:_,widths:p,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l;continue}const d=e[h+1]||t.font,g=ms(d,u);i.push(g),o+=g;const f=_s(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,g),v=f+d,x=[],w=(v+2)*h[0],C=(_+d)*h[1],S={width:w<0?Math.floor(w):Math.ceil(w),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",d),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const E=.5-u;let b=u*v+E*d;const T=[],R=[];let I,M=0,P=0,L=0,F=0;for(let t=0,e=g.length;t<e;t+=2){const e=g[t];if("\n"===e){P+=M,M=0,b=u*v+E*d,++F;continue}const s=g[t+1]||a.font;s!==I&&(n&&T.push("font",s),i&&R.push("font",s),I=s),M=Math.max(M,m[L]);const r=[e,b+E*p[L]+u*(p[L]-y[F]),.5*(d+M)+P];b+=p[L],n&&T.push("strokeText",r),i&&R.push("fillText",r),++L}return Array.prototype.push.apply(x,T),Array.prototype.push.apply(x,R),this.labels_[s]=S,S}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignFill_=r[2],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,_){let p=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,v=r+h>e?e-h:r,x=g[3]+y*u[0]+g[1],w=g[0]+v*u[1]+g[2],C=p-g[3],S=m-g[0];let E;return(f||0!==c)&&(_h[0]=C,yh[0]=C,_h[1]=S,ph[1]=S,ph[0]=C+x,mh[0]=ph[0],mh[1]=S+w,yh[1]=mh[1]),0!==c?(E=lt([1,0,0,1,0,0],i,n,1,1,c,-i,-n),at(E,_h),at(E,ph),at(E,mh),at(E,yh),xt(Math.min(_h[0],ph[0],mh[0],yh[0]),Math.min(_h[1],ph[1],mh[1],yh[1]),Math.max(_h[0],ph[0],mh[0],yh[0]),Math.max(_h[1],ph[1],mh[1],yh[1]),fh)):xt(Math.min(C,C+x),Math.min(S,S+w),Math.max(C,C+x),Math.max(S,S+w),fh),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:v,originX:l,originY:h,declutterBox:{minX:fh[0],minY:fh[1],maxX:fh[2],maxY:fh[3],value:_},canvasTransform:E,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=t.canvas,c=o?o[2]*n.scale[0]/2:0;return l.minX-c<=h.width/e&&l.maxX+c>=0&&l.minY-c<=h.height/e&&l.maxY+c>=0&&(a&&this.replayTextBackground_(t,_h,ph,mh,yh,r,o),function(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=at(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=wh(Array.isArray(t)?t[0]:t,s.textAlign||as),h=ch[s.textBaseline||ls],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){let l;var h,c;this.pixelCoordinates_&&C(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Wi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=i,(h=this.renderedTransform_)[0]=c[0],h[1]=c[1],h[2]=c[2],h[3]=c[3],h[4]=c[4],h[5]=c[5]);let u=0;const d=n.length;let g,f,_,p,m,y,v,x,w,S,E,b,T=0,R=0,I=0,M=null,P=null;const L=this.coordinateCache_,F=this.viewRotation_,k=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:F},A=this.instructions!=n||this.overlaps?0:200;let D,G,j,z;for(;u<d;){const i=n[u];switch(i[0]){case sh.BEGIN_GEOMETRY:D=i[1],z=i[3],D.getGeometry()?void 0===o||Xt(o,z.getExtent())?++u:u=i[2]+1:u=i[2];break;case sh.BEGIN_PATH:R>A&&(this.fill_(t),R=0),I>A&&(t.stroke(),I=0),R||I||(t.beginPath(),p=NaN,m=NaN),++u;break;case sh.CIRCLE:T=i[1];const n=l[T],h=l[T+1],c=l[T+2]-n,d=l[T+3]-h,C=Math.sqrt(c*c+d*d);t.moveTo(n+C,h),t.arc(n,h,C,0,2*Math.PI,!0),++u;break;case sh.CLOSE_PATH:t.closePath(),++u;break;case sh.CUSTOM:T=i[1],g=i[2];const N=i[3],W=i[4],X=6==i.length?i[5]:void 0;O.geometry=N,O.feature=D,u in L||(L[u]=[]);const Y=L[u];X?X(l,T,g,2,Y):(Y[0]=l[T],Y[1]=l[T+1],Y.length=2),W(Y,O),++u;break;case sh.DRAW_IMAGE:T=i[1],g=i[2],x=i[3],f=i[4],_=i[5];let B=i[6];const Z=i[7],K=i[8],V=i[9],U=i[10];let H=i[11];const q=i[12];let J=i[13];const $=i[14],Q=i[15];if(!x&&i.length>=20){w=i[19],S=i[20],E=i[21],b=i[22];const t=this.drawLabelWithPointPlacement_(w,S,E,b);x=t.label,i[3]=x;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,B=x.height,i[6]=B,J=x.width,i[13]=J}let tt,et,it,nt;i.length>25&&(tt=i[25]),i.length>17?(et=i[16],it=i[17],nt=i[18]):(et=hs,it=!1,nt=!1),U&&k?H+=F:U||k||(H-=F);let st=0;for(;T<g;T+=2){if(tt&&tt[st++]<J/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(x.width,x.height,l[T],l[T+1],J,B,f,_,K,V,H,q,s,et,it||nt,D),n=[t,e,x,i,Z,it?M:null,nt?P:null];if(a){if("none"===$)continue;if("obstacle"===$){a.insert(i.declutterBox);continue}{let t,e;if(Q){const i=g-T;if(!Q[i]){Q[i]=n;continue}if(t=Q[i],delete Q[i],e=vh(t),a.collides(e))continue}if(a.collides(i.declutterBox))continue;t&&(a.insert(e),this.replayImageOrLabel_.apply(this,t)),a.insert(i.declutterBox)}}this.replayImageOrLabel_.apply(this,n)}++u;break;case sh.DRAW_CHARS:const rt=i[1],ot=i[2],at=i[3],lt=i[4];b=i[5];const ht=i[6],ct=i[7],ut=i[8];E=i[9];const dt=i[10];w=i[11],S=i[12];const gt=[i[13],i[13]],ft=this.textStates[S],_t=ft.font,pt=[ft.scale[0]*ct,ft.scale[1]*ct];let mt;_t in this.widths_?mt=this.widths_[_t]:(mt={},this.widths_[_t]=mt);const yt=Co(l,rt,ot,2),vt=Math.abs(pt[0])*ys(_t,w,mt);if(lt||vt<=yt){const i=gh(l,rt,ot,2,w,(yt-vt)*wh(w,this.textStates[S].textAlign),ht,Math.abs(pt[0]),ys,_t,mt,k?0:this.viewRotation_);t:if(i){const n=[];let s,r,o,l,h;if(E)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,S,"",E),f=h[2]+(pt[0]<0?-dt:dt),_=at*l.height+2*(.5-at)*dt*pt[1]/pt[0]-ut;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,f,_,0,0,h[3],gt,!1,hs,!1,D);if(a&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(b)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,S,b,""),f=h[2],_=at*l.height-ut;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,f,_,0,0,h[3],gt,!1,hs,!1,D);if(a&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&a.load(n.map(vh));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++u;break;case sh.END_GEOMETRY:if(void 0!==r){D=i[1];const t=r(D,z);if(t)return t}++u;break;case sh.FILL:A?R++:this.fill_(t),++u;break;case sh.MOVE_TO_LINE_TO:for(T=i[1],g=i[2],G=l[T],j=l[T+1],y=G+.5|0,v=j+.5|0,y===p&&v===m||(t.moveTo(G,j),p=y,m=v),T+=2;T<g;T+=2)G=l[T],j=l[T+1],y=G+.5|0,v=j+.5|0,T!=g-2&&y===p&&v===m||(t.lineTo(G,j),p=y,m=v);++u;break;case sh.SET_FILL_STYLE:M=i,this.alignFill_=i[2],R&&(this.fill_(t),R=0,I&&(t.stroke(),I=0)),t.fillStyle=i[1],++u;break;case sh.SET_STROKE_STYLE:P=i,I&&(t.stroke(),I=0),this.setStrokeStyle_(t,i),++u;break;case sh.STROKE:A?I++:t.stroke(),++u;break;default:++u}}R&&this.fill_(t),I&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,1,e,this.hitDetectionInstructions,!0,n,s)}},Eh=["Polygon","Circle","LineString","Image","Text","Default"],bh={},Th=class{constructor(t,e,i,n,s,r){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.createExecutors_(s)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t){for(const e in t){let i=this.executorsByZIndex_[e];void 0===i&&(i={},this.executorsByZIndex_[e]=i);const n=t[e];for(const t in n){const e=n[t];i[t]=new Sh(this.resolution_,this.pixelRatio_,this.overlaps_,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,a=lt(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=Jn(o,o,void 0,{willReadFrequently:!0}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],Tt(c,t),gt(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==bh[t])return bh[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return bh[t]=s,s}(n);let d;function g(t,e){const i=h.getImageData(0,0,o,o).data;for(let a=0,l=u.length;a<l;a++)if(i[u[a]]>0){if(!r||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[a]-3)/4,r=n-i%o,l=n-(i/o|0),h=s(t,e,r*r+l*l);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let _,p,m,v,x;for(f.sort(y),_=f.length-1;_>=0;--_){const t=f[_].toString();for(m=this.executorsByZIndex_[t],p=Eh.length-1;p>=0;--p)if(d=Eh[p],v=m[d],void 0!==v&&(x=v.executeHitDetection(h,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return Wi(o,0,8,2,t,o),o}isEmpty(){return I(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let l,h,c,u,d,g;for(a.sort(y),this.maxExtent_&&(t.save(),this.clip(t,i)),r=r||Eh,o&&a.reverse(),l=0,h=a.length;l<h;++l){const h=a[l].toString();for(d=this.executorsByZIndex_[h],c=0,u=r.length;c<u;++c)g=d[r[c]],void 0!==g&&g.execute(t,e,i,n,s,o)}this.maxExtent_&&t.restore()}},Rh=class extends rh{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?ae(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=Wi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;lt(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=Wi(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=Wi(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let t=2;t<a;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Xt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return Wi(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Xt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Xt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Xt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Xt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),C(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:as;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Vo(e||is)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||ss;this.strokeState_={lineCap:void 0!==i?i:ns,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:rs,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Vo(t||os)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Vo(t||is)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:ns,lineDash:n||ss,lineDashOffset:s||0,lineJoin:void 0!==r?r:rs,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Vo(t||os)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:es,textAlign:void 0!==c?c:as,textBaseline:void 0!==u?u:ls},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},Ih=.5,Mh={Point:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let a;if(r){if(2!=r.getImageState())return;let l=t;if(s){const h=r.getDeclutterMode();if("none"!==h)if(l=s,"obstacle"===h){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,a),s.drawPoint(e,n)}else o&&o.getText()&&(a={})}const h=l.getBuilder(i.getZIndex(),"Image");h.setImageStyle(r,a),h.drawPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const l=r.getBuilder(i.getZIndex(),"Text");l.setTextStyle(o,a),l.drawText(e,n)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}},MultiPoint:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let a;if(r){if(2!=r.getImageState())return;let l=t;if(s){const h=r.getDeclutterMode();if("none"!==h)if(l=s,"obstacle"===h){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,a),s.drawMultiPoint(e,n)}else o&&o.getText()&&(a={})}const h=l.getBuilder(i.getZIndex(),"Image");h.setImageStyle(r,a),h.drawMultiPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const l=r.getBuilder(i.getZIndex(),"Text");l.setTextStyle(o,a),l.drawText(e,n)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawMultiLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawMultiPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}},GeometryCollection:function(t,e,i,n,s){const r=e.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o)(0,Mh[r[o].getType()])(t,r[o],i,n,s)},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Circle");s.setFillStrokeStyle(r,o),s.drawCircle(e,n)}const a=i.getText();if(a&&a.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n)}}};function Ph(t,e){return parseInt(B(t),10)-parseInt(B(e),10)}function Lh(t,e){return.5*t/e}function Fh(t,e,i,n,s,r,o){let a=!1;const l=i.getImage();if(l){const t=l.getImageState();2==t||3==t?l.unlistenImageChange(s):(0==t&&l.load(),l.listenImageChange(s),a=!0)}return function(t,e,i,n,s,r){const o=i.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(n,s);i.getRenderer()?kh(t,a,i,e):(0,Mh[a.getType()])(t,a,i,e,r)}(t,e,i,n,r,o),a}function kh(t,e,i,n){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,r=s.length;e<r;++e)kh(t,s[e],i,n);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer())}const Oh=class extends Fr{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=e.pixelRatio,d=e.viewHints,g=!(d[0]||d[1]),f=this.compositionContext_,_=Math.round(e.size[0]*u),p=Math.round(e.size[1]*u),m=c.getWrapX()&&a.canWrapX(),y=m?Wt(h):null,v=m?Math.ceil((n[2]-h[2])/y)+1:1;let x=m?Math.floor((n[0]-h[0])/y):0;do{const e=this.getRenderTransform(r,o,l,u,_,p,x*y);t.execute(f,1,e,l,g,void 0,i)}while(++x<v)}setupCompositionContext_(){if(1!==this.opacity_){const t=Jn(this.context.canvas.width,this.context.canvas.height,Pr);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(1!==this.opacity_){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,$n(this.compositionContext_),Pr.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];!function(t,e,i){!function(t,e,i,n,s,r,o){t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=o}(t,e,0,0,i,0,0)}(this.pixelTransform,1/i,1/i),ht(this.inversePixelTransform,this.pixelTransform);const s=ut(this.pixelTransform);this.useContainer(e,s,this.getBackground(t));const r=this.context,o=r.canvas,a=this.replayGroup_,l=this.declutterExecutorGroup;let h=a&&!a.isEmpty()||l&&!l.isEmpty();if(!h&&!this.getLayer().hasListener(Le)&&!this.getLayer().hasListener(Fe))return null;const c=Math.round(t.size[0]*i),u=Math.round(t.size[1]*i);o.width!=c||o.height!=u?(o.width=c,o.height=u,o.style.transform!==s&&(o.style.transform=s)):this.containerReused||r.clearRect(0,0,c,u),this.preRender(r,t);const d=t.viewState;d.projection;this.opacity_=n.opacity,this.setupCompositionContext_();let g=!1;if(h&&n.extent&&this.clipping){const e=bi(n.extent);h=Xt(e,t.extent),g=h&&!mt(e,t.extent),g&&this.clipUnrotated(this.compositionContext_,t,e)}return h&&this.renderWorlds(a,t),g&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];at(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*Ih,h=t[1]*Ih;a.push(this.getRenderTransform(e,i,n,Ih,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!mt(u,r)){let t=r[0];const s=Wt(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,Ih,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,Ih,l,h,o).slice()),t-=s}this.hitDetectionImageData_=function(t,e,i,n,s,r,o){const a=Jn(t[0]*Ih,t[1]*Ih);a.imageSmoothingEnabled=!1;const l=a.canvas,h=new Rh(a,Ih,s,null,o),c=i.length,u=Math.floor(16777215/c),d={};for(let t=1;t<=c;++t){const e=i[t-1],o=e.getStyleFunction()||n;if(!o)continue;let a=o(e,r);if(!a)continue;Array.isArray(a)||(a=[a]);const l=(t*u).toString(16).padStart(7,"#00000");for(let t=0,i=a.length;t<i;++t){const i=a[t],n=i.getGeometryFunction()(e);if(!n||!Xt(s,n.getExtent()))continue;const r=i.clone(),o=r.getFill();o&&o.setColor(l);const h=r.getStroke();h&&(h.setColor(l),h.setLineDash(null)),r.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=Jn(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=l,e.fillRect(0,0,i.width,i.height),r.setImage(new ua({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=r.getZIndex()||0;let g=d[u];g||(g={},d[u]=g,g.Polygon=[],g.Circle=[],g.LineString=[],g.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];g[i.getType().replace("Multi","")].push(i,r)}}else g[f.replace("Multi","")].push(n,r)}}const g=Object.keys(d).map(Number).sort(y);for(let t=0,i=g.length;t<i;++t){const i=d[g[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){h.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)h.setTransform(e[i]),h.drawGeometry(n[t])}}}return a.getImageData(0,0,l.width,l.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*Ih),r=Math.floor(Math.round(t[1])*Ih),o=4*(ee(s,0,i.width-1)+ee(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const r=B(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}};let c;const u=[this.replayGroup_];return this.declutterExecutorGroup&&u.push(this.declutterExecutorGroup),u.some(n=>c=n.forEachFeatureAtCoordinate(t,r,o,i,h,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(t=>t.value):null)),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],s=t.viewHints[1],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=Ph);const _=l.center.slice(),p=gt(a,g*c),m=p.slice(),y=[p.slice()],v=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!mt(v,t.extent)){const t=Wt(v),e=Math.max(Wt(p)/2,t);p[0]=v[0]-e,p[2]=v[2]+e,ti(_,h);const i=Bt(y[0],h);i[0]<v[0]&&i[2]<v[2]?y.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>v[0]&&i[2]>v[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&mt(this.wrappedRenderedExtent_,p))return C(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new dh(Lh(c,u),p,c,u);let w;this.getLayer().getDeclutter()&&(w=new dh(Lh(c,u),p,c,u));const S=wi();let E;if(S){for(let t=0,e=y.length;t<e;++t){const e=Ei(y[t]);i.loadFeatures(e,Ti(c),S)}E=pi(S,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const b=function(t,e){const i=Lh(t,e);return i*i}(c,u);let T=!0;const R=t=>{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,b,i,x,E,w);T=T&&!e}},I=Ei(p),M=i.getFeaturesInExtent(I);f&&M.sort(f);for(let t=0,e=M.length;t<e;++t)R(M[t]);this.renderedFeatures_=M,this.ready=T;const P=x.finish(),L=new Th(p,c,u,i.getOverlaps(),P,e.getRenderBuffer());return w&&(this.declutterExecutorGroup=new Th(p,c,u,i.getOverlaps(),w.finish(),e.getRenderBuffer())),this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=h,this.replayGroup_=L,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Fh(n,t,i[a],e,this.boundHandleStyleImageChange_,s,r)||o;else o=Fh(n,t,i,e,this.boundHandleStyleImageChange_,s,r);return o}},Ah=class extends $l{constructor(t){super(t)}createRenderer(){return new Oh(this)}},Dh=class{constructor(t){this.rbush_=new Bo(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[B(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,s=e.length;n<s;n++){const s=t[n],r=e[n],o={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:r};i[n]=o,this.items_[B(r)]=o}this.rbush_.load(i)}remove(t){const e=B(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[B(e)];Et([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return I(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return xt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},Gh="addfeature",jh="removefeature";function zh(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Nh(t,e){return function(i,n,s,r,o){const a=this;!function(t,e,i,n,s,r,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();let n;"json"==t?n=JSON.parse(a.responseText):"text"==t?n=a.responseText:"xml"==t?(n=a.responseXML,n||(n=(new DOMParser).parseFromString(a.responseText,"application/xml"))):"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}else o()},a.onerror=o,a.send()}(t,e,i,n,s,function(t,e){a.addFeatures(t),void 0!==r&&r(t)},o||b)}}class Wh extends _{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const Xh=class extends Qr{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=b,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(ot(this.format_,"`format` must be set when `url` is set"),this.loader_=Nh(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:zh;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Dh:null,this.loadedExtentsRtree_=new Dh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new J(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=B(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Wh(Gh,t))}setupChangeEvents_(t,e){e instanceof wo||(this.featureChangeKeys_[t]=[G(e,P,this.handleFeatureChange_,this),G(e,p,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof wo){const n=this.idIndex_[t];n instanceof wo?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(ot(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],s=B(n);this.addToIndex_(s,n)&&i.push(n)}for(let t=0,s=i.length;t<s;t++){const s=i[t],r=B(s);this.setupChangeEvents_(r,s);const o=s.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(s)}else this.nullGeometryFeatures_[r]=s}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Gh))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Wh(Gh,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Gh,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(jh,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(V,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(U,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(z);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Wh("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof wo||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof wo||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),I(this.nullGeometryFeatures_)||w(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=function(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];Bt(t,e);const n=Wt(i);if(Wt(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]<i[0])return[[t[0]+n,t[1],i[2],t[3]],[i[0],t[1],t[2],t[3]]];if(t[2]>i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||S,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof wo?0:e.closestPointXY(i,n,r,o),o<l){s=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),s}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=B(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const s=e.getId();if(void 0!==s){const t=s.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Wh("changefeature",e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:B(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&I(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let t=0,r=s.length;t<r;++t){const r=s[t];n.forEachInExtent(r,function(t){return mt(t.extent,r)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Wh("featuresloadstart")),this.loader_.call(this,r,e,i,t=>{--this.loadingExtentsCount_,this.dispatchEvent(new Wh("featuresloadend",void 0,t))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Wh("featuresloaderror"))}),n.insert(r,{extent:r.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,function(e){if(Et(e.extent,t))return i=e,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=B(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=B(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(z),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Wh(jh,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof wo&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){ot(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Nh(t,this.format_))}};function Yh(t){return Yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yh(t)}function Bh(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Zh(n.key),n)}}function Zh(t){var e=function(t){if("object"!=Yh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Yh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yh(e)?e:e+""}function Kh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Kh=function(){return!!t})()}function Vh(t){return Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vh(t)}function Uh(t,e){return Uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uh(t,e)}var Hh=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,i){return e=Vh(e),function(t,e){if(e&&("object"==Yh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kh()?Reflect.construct(e,i||[],Vh(t).constructor):e.apply(t,i))}(this,e)).map=null,t.layers={},t.eventHandlers={},console.log("OpenLayersAdapter initialized, eventHandlers:",t.eventHandlers),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uh(t,e)}(e,t),i=e,(n=[{key:"createMap",value:function(t,e){var i={target:t,view:new jn({center:fi([e.lng,e.lat]),zoom:e.zoom||10,minZoom:e.minZoom,maxZoom:e.maxZoom}),controls:Ys({attribution:!0,zoom:!0})};return this.map=new br(i),this._addDefaultBaseLayer(),this}},{key:"addLayer",value:function(t){if(!this.map)return console.warn("地图未初始化"),this;var e;switch(t.type){case"tile":e=this._createTileLayer(t);break;case"geojson":e=this._createGeoJSONLayer(t);break;default:return console.warn("不支持的图层类型:",t.type),this}return e&&(this.map.addLayer(e),this.layers[t.id]=e),this}},{key:"removeLayer",value:function(t){var e=this.layers[t];return e&&this.map&&(this.map.removeLayer(e),delete this.layers[t]),this}},{key:"setCenter",value:function(t,e,i){if(this.map){var n=this.map.getView();n.setCenter(fi([t,e])),void 0!==i&&n.setZoom(i)}return this}},{key:"setZoom",value:function(t){return this.map&&this.map.getView().setZoom(t),this}},{key:"getBounds",value:function(){if(!this.map)return null;var t=vi(this.map.getView().calculateExtent(this.map.getSize()),"EPSG:3857","EPSG:4326");return{minLng:t[0],maxLng:t[2],minLat:t[1],maxLat:t[3]}}},{key:"on",value:function(t,e){return this.map&&(this.map.on(t,e),this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)),this}},{key:"off",value:function(t,e){return this.map&&(e?this.map.un(t,e):this.map.un(t)),this}},{key:"destroy",value:function(){this.map&&(this.map.setTarget(null),this.map=null),this.layers={},this.eventHandlers={}}},{key:"getNativeMap",value:function(){return this.map}},{key:"_addDefaultBaseLayer",value:function(){var t=new Kr({source:new go({url:"https://t{0-7}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",projection:"EPSG:3857",attributions:"© 天地图"})}),e=new Kr({source:new go({url:"https://t{0-7}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",projection:"EPSG:3857",attributions:"© 天地图"})});this.map.addLayer(t),this.map.addLayer(e),this.layers["base-layer"]=t,this.layers["base-layer-label"]=e}},{key:"_createTileLayer",value:function(t){return new Kr({source:new go({url:t.url,minZoom:t.minZoom||0,maxZoom:t.maxZoom||18,attributions:t.attribution||""}),opacity:void 0!==t.opacity?t.opacity:1})}},{key:"_createGeoJSONLayer",value:function(t){var e=new Xh({features:(new Yo).readFeatures(t.data||{},{featureProjection:"EPSG:3857"})});return new Ah({source:e,style:t.style||{}})}}])&&Bh(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n);function qh(t){return qh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qh(t)}function Jh(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$h(n.key),n)}}function $h(t){var e=function(t){if("object"!=qh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=qh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qh(e)?e:e+""}function Qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qh=function(){return!!t})()}function tc(t){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tc(t)}function ec(t,e){return ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ec(t,e)}var ic=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e,i){return e=tc(e),function(t,e){if(e&&("object"==qh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qh()?Reflect.construct(e,i||[],tc(t).constructor):e.apply(t,i))}(this,e)).viewer=null,t.layers={},t.eventHandlers={},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ec(t,e)}(e,t),i=e,(n=[{key:"createMap",value:function(t,e){var i=window.Cesium;void 0===i.Ion.defaultAccessToken&&(i.Ion.defaultAccessToken="your-access-token-here");return this.viewer=new i.Viewer(t,{infoBox:!1,selectionIndicator:!1,shadows:!1,shouldAnimate:!0,timeline:!1,animation:!1,geocoder:!1,homeButton:!0,sceneModePicker:!0,baseLayerPicker:!1,navigationHelpButton:!1,fullscreenButton:!0,requestRenderMode:!0,maximumRenderTimeChange:1/0,imageryProvider:!1}),this.viewer.camera&&this.viewer.camera.setView({destination:i.Cartesian3.fromDegrees(e.lng,e.lat,this._calculateHeight(e.zoom||10))}),this._addDefaultBaseLayer(),this}},{key:"addLayer",value:function(t){if(!this.viewer)return console.warn("地图未初始化"),this;var e;switch(t.type){case"tile":e=this._createImageryLayer(t);break;case"geojson":e=this._createGeoJSONLayer(t);break;default:return console.warn("不支持的图层类型:",t.type),this}return e&&("tile"===t.type?(this.viewer.imageryLayers.addImageryProvider(e),this.layers[t.id]=e):(this.viewer.entities.add(e),this.layers[t.id]=e)),this}},{key:"removeLayer",value:function(t){var e=this.layers[t];return e&&this.viewer&&(e.imageryProvider?this.viewer.imageryLayers.remove(this.viewer.imageryLayers.find(function(t){return t.imageryProvider===e})):this.viewer.entities.remove(e),delete this.layers[t]),this}},{key:"setCenter",value:function(t,e,i){var n=window.Cesium;if(this.viewer&&this.viewer.camera){var s=void 0!==i?this._calculateHeight(i):this.viewer.camera.positionCartographic.height;this.viewer.camera.flyTo({destination:n.Cartesian3.fromDegrees(t,e,s),duration:1.5})}return this}},{key:"setZoom",value:function(t){var e=window.Cesium;if(this.viewer&&this.viewer.camera){var i=this.viewer.camera.positionCartographic;this.viewer.camera.flyTo({destination:e.Cartesian3.fromRadians(i.longitude,i.latitude,this._calculateHeight(t)),duration:1})}return this}},{key:"getBounds",value:function(){var t=window.Cesium;if(!this.viewer)return null;this.viewer.scene.canvas;var e=this.viewer.camera.computeViewRectangle();return{minLng:t.Math.toDegrees(e.west),maxLng:t.Math.toDegrees(e.east),minLat:t.Math.toDegrees(e.south),maxLat:t.Math.toDegrees(e.north)}}},{key:"on",value:function(t,e){var i=window.Cesium;if(this.viewer){switch(this.screenSpaceEventHandler||(this.screenSpaceEventHandler=new i.ScreenSpaceEventHandler(this.viewer.scene.canvas)),t){case"click":this.screenSpaceEventHandler.setInputAction(function(t){e({position:t.position,longitude:null,latitude:null})},i.ScreenSpaceEventType.LEFT_CLICK);break;case"mousemove":this.screenSpaceEventHandler.setInputAction(function(t){e({position:t.endPosition,longitude:null,latitude:null})},i.ScreenSpaceEventType.MOUSE_MOVE);break;default:console.warn("Cesium 不支持事件:",t)}this.eventHandlers[t]||(this.eventHandlers[t]=[]),this.eventHandlers[t].push(e)}return this}},{key:"off",value:function(t,e){var i=window.Cesium;return this.viewer&&this.screenSpaceEventHandler&&("click"===t?this.screenSpaceEventHandler.removeInputAction(i.ScreenSpaceEventType.LEFT_CLICK):"mousemove"===t&&this.screenSpaceEventHandler.removeInputAction(i.ScreenSpaceEventType.MOUSE_MOVE)),this}},{key:"destroy",value:function(){this.screenSpaceEventHandler&&(this.screenSpaceEventHandler.destroy(),this.screenSpaceEventHandler=null),this.viewer&&(this.viewer.destroy(),this.viewer=null),this.layers={},this.eventHandlers={}}},{key:"getNativeMap",value:function(){return this.viewer}},{key:"_addDefaultBaseLayer",value:function(){var t=window.Cesium;try{var e=new t.UrlTemplateImageryProvider({url:"https://t{s}.tianditu.gov.cn/DataServer?T=ter_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",subdomains:["0","1","2","3","4","5","6","7"],tilingScheme:new t.WebMercatorTilingScheme,maximumLevel:18,credit:new t.Credit("天地图")}),i=new t.UrlTemplateImageryProvider({url:"https://t{s}.tianditu.gov.cn/DataServer?T=cta_w&x={x}&y={y}&l={z}&tk=f57cee0422e397a83b88aebf2642f1c6",subdomains:["0","1","2","3","4","5","6","7"],tilingScheme:new t.WebMercatorTilingScheme,maximumLevel:18,credit:new t.Credit("天地图")});this.viewer.imageryLayers.addImageryProvider(e),this.viewer.imageryLayers.addImageryProvider(i),this.layers["base-layer"]=e,this.layers["base-layer-label"]=i}catch(t){console.warn("添加默认底图失败:",t)}}},{key:"_createImageryLayer",value:function(t){var e=window.Cesium;try{return new e.UrlTemplateImageryProvider({url:t.url,subdomains:["a","b","c"],maximumLevel:t.maxZoom||18,minimumLevel:t.minZoom||0,credit:t.attribution||""})}catch(t){return console.error("创建影像图层失败:",t),null}}},{key:"_createGeoJSONLayer",value:function(t){var e=window.Cesium;return t.data&&t.data.coordinates?this.viewer.entities.add({position:e.Cartesian3.fromDegrees(t.data.coordinates[0],t.data.coordinates[1]),point:{pixelSize:10,color:e.Color.YELLOW,outlineColor:e.Color.BLACK,outlineWidth:2}}):null}},{key:"_calculateHeight",value:function(t){var e=2e7,i=e/Math.pow(2,t);return Math.max(1e3,Math.min(e,i))}}])&&Jh(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n);function nc(t){return nc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nc(t)}function sc(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rc(n.key),n)}}function rc(t){var e=function(t){if("object"!=nc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=nc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nc(e)?e:e+""}var oc={LEAFLET:"leaflet",OPENLAYERS:"openlayers",MAPBOX:"mapbox",CESIUM:"cesium"},ac=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"create",value:function(t){switch(t){case oc.LEAFLET:return new f;case oc.OPENLAYERS:return new Hh;case oc.MAPBOX:throw new Error("MapboxGL 适配器尚未实现");case oc.CESIUM:return new ic;default:throw new Error("不支持的地图引擎类型: ".concat(t))}}},{key:"isEngineAvailable",value:function(t){switch(t){case oc.LEAFLET:return void 0!==window.L;case oc.OPENLAYERS:return void 0!==window.ol;case oc.MAPBOX:return void 0!==window.mapboxgl;case oc.CESIUM:return void 0!==window.Cesium;default:return!1}}},{key:"getEngineVersion",value:function(t){switch(t){case oc.LEAFLET:return window.L?window.L.version:null;case oc.OPENLAYERS:return window.ol?window.ol.VERSION:null;case oc.MAPBOX:var e=window.mapboxgl;return e?e.version:null;case oc.CESIUM:var i=window.Cesium;return i?i.VERSION:null;default:return null}}}],null&&sc(t.prototype,null),e&&sc(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),lc="1.0.0"})(),r})());
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "multi-map-engine",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "统一API的多地图引擎适配框架,支持Leaflet、OpenLayers、Cesium无缝切换",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "webpack serve --mode development --open",
|
|
13
|
+
"build": "webpack --config webpack.config.pub.js --mode production",
|
|
14
|
+
"build:demo": "webpack --mode production",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"leaflet",
|
|
19
|
+
"openlayers",
|
|
20
|
+
"mapbox",
|
|
21
|
+
"cesium",
|
|
22
|
+
"map",
|
|
23
|
+
"gis",
|
|
24
|
+
"adapter",
|
|
25
|
+
"3d",
|
|
26
|
+
"webgis",
|
|
27
|
+
"地图引擎"
|
|
28
|
+
],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"leaflet": "^1.9.0",
|
|
33
|
+
"ol": "^8.0.0",
|
|
34
|
+
"cesium": "^1.108.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/core": "^7.22.0",
|
|
38
|
+
"@babel/preset-env": "^7.22.0",
|
|
39
|
+
"babel-loader": "^9.1.0",
|
|
40
|
+
"copy-webpack-plugin": "^13.0.1",
|
|
41
|
+
"css-loader": "^6.8.0",
|
|
42
|
+
"html-webpack-plugin": "^5.5.0",
|
|
43
|
+
"style-loader": "^3.3.0",
|
|
44
|
+
"webpack": "^5.88.0",
|
|
45
|
+
"webpack-cli": "^5.1.0",
|
|
46
|
+
"webpack-dev-server": "^4.15.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"cesium": "^1.108.0",
|
|
50
|
+
"leaflet": "^1.9.4",
|
|
51
|
+
"ol": "^8.2.0"
|
|
52
|
+
}
|
|
53
|
+
}
|